Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions byteyarn/src/convert.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::borrow::Borrow;
use std::convert::Infallible;
use std::fmt;
use std::str::FromStr;
use std::str::Utf8Error;

use crate::YarnBox;
Expand Down Expand Up @@ -224,6 +226,14 @@ impl From<YarnRef<'_, str>> for String {
}
}

impl FromStr for YarnBox<'static, str> {
type Err = Infallible;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self::copy(s))
}
}

// AsRef / Borrow

impl<Buf> AsRef<Buf> for YarnBox<'_, Buf>
Expand Down