(s: String)
| 125 | type Error = PromiseError; |
| 126 | |
| 127 | fn try_from(s: String) -> Result<Self, Self::Error> { |
| 128 | let len = s.len(); |
| 129 | if len <= Promise::MAX_BYTES { |
| 130 | Ok(Promise(s)) |
| 131 | } else { |
| 132 | Err(PromiseError::TooLong { |
| 133 | length: len, |
| 134 | max: Promise::MAX_BYTES, |
| 135 | }) |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | impl TryFrom<&str> for Promise { |