Struct partiql_source_map::location::Located
source · [−]Expand description
A wrapper type that holds an inner
value and a location
for it
Fields
inner: T
The item that has a location attached
location: Location<Loc>
The location of the error
Implementations
sourceimpl<T, Loc: Display> Located<T, Loc>
impl<T, Loc: Display> Located<T, Loc>
sourcepub fn map_loc<F, Loc2>(self, tx: F) -> Located<T, Loc2> where
Loc2: Display,
F: FnMut(Loc) -> Loc2,
pub fn map_loc<F, Loc2>(self, tx: F) -> Located<T, Loc2> where
Loc2: Display,
F: FnMut(Loc) -> Loc2,
Maps an Located<T, Loc>
to Located<T, Loc2>
by applying a function to the contained
location and moving the contained inner
Example
assert_eq!("blah".to_string()
.to_located(BytePosition::from(5)..BytePosition::from(10))
.map_loc(|BytePosition(o)| BytePosition(o+5)),
Located{
inner: "blah".to_string(),
location: (BytePosition(ByteOffset(10))..BytePosition(ByteOffset(15))).into()
});
Trait Implementations
impl<T: Eq, Loc: Eq + Display> Eq for Located<T, Loc>
impl<T, Loc: Display> StructuralEq for Located<T, Loc>
impl<T, Loc: Display> StructuralPartialEq for Located<T, Loc>
Auto Trait Implementations
impl<T, Loc> RefUnwindSafe for Located<T, Loc> where
Loc: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Loc> Send for Located<T, Loc> where
Loc: Send,
T: Send,
impl<T, Loc> Sync for Located<T, Loc> where
Loc: Sync,
T: Sync,
impl<T, Loc> Unpin for Located<T, Loc> where
Loc: Unpin,
T: Unpin,
impl<T, Loc> UnwindSafe for Located<T, Loc> where
Loc: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more