We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5222dd3 + c1837e1 commit 6dedc9bCopy full SHA for 6dedc9b
src/bewit.rs
@@ -74,6 +74,12 @@ impl<'a> Bewit<'a> {
74
}
75
76
77
+impl<'a> From<Bewit<'a>> for String {
78
+ fn from(bewit: Bewit<'a>) -> Self {
79
+ bewit.to_str()
80
+ }
81
+}
82
+
83
const BACKSLASH: u8 = b'\\';
84
85
impl<'a> FromStr for Bewit<'a> {
@@ -171,6 +177,17 @@ mod test {
171
177
assert_eq!(bewit.to_str(), BEWIT_WITH_EXT_STR);
172
178
173
179
180
+ #[test]
181
+ fn test_from_bewit_for_string() {
182
+ let bewit = Bewit::new(
183
+ "me",
184
+ UNIX_EPOCH + Duration::new(1353832834, 0),
185
+ make_mac(),
186
+ None,
187
+ );
188
+ assert_eq!(String::from(bewit), BEWIT_STR);
189
190
174
191
#[test]
175
192
fn test_accessors() {
176
193
let bewit = Bewit::from_str(BEWIT_STR).unwrap();
0 commit comments