pub struct Sourced<T> { /* private fields */ }Expand description
A value and every source location that contributed to it.
Implementations§
Source§impl<T> Sourced<T>
impl<T> Sourced<T>
Sourcepub const fn generated(value: T) -> Self
pub const fn generated(value: T) -> Self
Creates a value without source provenance, such as a generated default.
Sourcepub fn from_source(value: T, origin: Provenance) -> Self
pub fn from_source(value: T, origin: Provenance) -> Self
Creates a value with one source origin.
Sourcepub fn add_origin(&mut self, origin: Provenance)
pub fn add_origin(&mut self, origin: Provenance)
Adds another contributing origin in discovery order.
Sourcepub fn origins(&self) -> &[Provenance]
pub fn origins(&self) -> &[Provenance]
Returns all origins in discovery order.
Sourcepub fn into_parts(self) -> (T, Vec<Provenance>)
pub fn into_parts(self) -> (T, Vec<Provenance>)
Decomposes the sourced value.
Trait Implementations§
impl<T: Eq> Eq for Sourced<T>
impl<T: PartialEq> StructuralPartialEq for Sourced<T>
Auto Trait Implementations§
impl<T> Freeze for Sourced<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sourced<T>where
T: RefUnwindSafe,
impl<T> Send for Sourced<T>where
T: Send,
impl<T> Sync for Sourced<T>where
T: Sync,
impl<T> Unpin for Sourced<T>where
T: Unpin,
impl<T> UnsafeUnpin for Sourced<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Sourced<T>where
T: UnwindSafe,
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