Struct calypso_base::span::Spanned
source · [−]pub struct Spanned<T> where
T: Debug, { /* private fields */ }
Expand description
An object that’s associated with a Span
Example
let spanned = Spanned::new(Span::new(0, 1), 42);
// Since we're asserting more than one thing, we can't do `spanned.value_owned()`, as that would anger the borrow checker.
// Instead, since integers are `Copy`, we can just dereference the `&{integer}` we get back from `spanned.value()`.
assert_eq!(*spanned.value(), 42);
assert_eq!(spanned.span(), Span::new(0, 1));
Implementations
sourceimpl<T> Spanned<T> where
T: Debug,
impl<T> Spanned<T> where
T: Debug,
sourcepub fn value_owned(self) -> T
pub fn value_owned(self) -> T
Get the owned value.
Trait Implementations
impl<T: Copy> Copy for Spanned<T> where
T: Debug,
impl<T: Eq> Eq for Spanned<T> where
T: Debug,
impl<T> StructuralEq for Spanned<T> where
T: Debug,
impl<T> StructuralPartialEq for Spanned<T> where
T: Debug,
Auto Trait Implementations
impl<T> RefUnwindSafe for Spanned<T> where
T: RefUnwindSafe,
impl<T> Send for Spanned<T> where
T: Send,
impl<T> Sync for Spanned<T> where
T: Sync,
impl<T> Unpin for Spanned<T> where
T: Unpin,
impl<T> UnwindSafe for Spanned<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more