ToLocated

Trait ToLocated 

Source
pub trait ToLocated<Loc: Display>: Sized {
    // Provided method
    fn to_located<IntoLoc>(self, location: IntoLoc) -> Located<Self, Loc>
       where IntoLoc: Into<Location<Loc>> { ... }
}
Expand description

Trait adding a to_located method to ease construction of Located from its inner value.

§Example

assert_eq!("blah".to_string().to_located(BytePosition::from(5)..BytePosition::from(10)),
            Located{
                inner: "blah".to_string(),
                location:  (BytePosition(ByteOffset(5))..BytePosition(ByteOffset(10))).into()
            });

Provided Methods§

Source

fn to_located<IntoLoc>(self, location: IntoLoc) -> Located<Self, Loc>
where IntoLoc: Into<Location<Loc>>,

Create a Located from its inner value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, Loc: Display> ToLocated<Loc> for T