pub struct Loc<T: ?Sized> { /* private fields */ }
Expand description
Located data.
This is a simple wrapper around data that can be located in a source file. It is useful to wrap abstract syntax tree nodes.
It derefs into the inner value.
Implementations§
Source§impl<T: ?Sized> Loc<T>
impl<T: ?Sized> Loc<T>
Sourcepub fn new(t: T, span: Span) -> Loc<T>where
T: Sized,
pub fn new(t: T, span: Span) -> Loc<T>where
T: Sized,
Associate a span location to some data by wrapping it under Loc
.
Sourcepub fn inner_into<U>(self) -> Loc<U>where
T: Into<U>,
pub fn inner_into<U>(self) -> Loc<U>where
T: Into<U>,
Convert the inner value.
Sourcepub fn try_map<U, F, E>(self, f: F) -> Result<Loc<U>, E>
pub fn try_map<U, F, E>(self, f: F) -> Result<Loc<U>, E>
Tries to map the inner value using the given function.
Sourcepub fn inner_try_into<U>(self) -> Result<Loc<U>, <T as TryInto<U>>::Error>where
T: TryInto<U>,
pub fn inner_try_into<U>(self) -> Result<Loc<U>, <T as TryInto<U>>::Error>where
T: TryInto<U>,
Try to convert the inner value.
Sourcepub fn into_inner(self) -> Twhere
T: Sized,
pub fn into_inner(self) -> Twhere
T: Sized,
Unwrap the data.
Sourcepub fn into_raw_parts(self) -> (T, Span)where
T: Sized,
pub fn into_raw_parts(self) -> (T, Span)where
T: Sized,
Break the wrapper into the value and its location.
Trait Implementations§
Source§impl<T: Ord> Ord for Loc<T>
impl<T: Ord> Ord for Loc<T>
Source§impl<T: PartialOrd> PartialOrd for Loc<T>
impl<T: PartialOrd> PartialOrd for Loc<T>
impl<T: Eq> Eq for Loc<T>
Auto Trait Implementations§
impl<T> Freeze for Loc<T>
impl<T> RefUnwindSafe for Loc<T>where
T: RefUnwindSafe + ?Sized,
impl<T> Send for Loc<T>
impl<T> Sync for Loc<T>
impl<T> Unpin for Loc<T>
impl<T> UnwindSafe for Loc<T>where
T: UnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more