Skip to main content

WrappingSpan

Trait WrappingSpan 

Source
pub trait WrappingSpan<T>: Span {
    type Spanned;

    // Required methods
    fn make_wrapped(self, inner: T) -> Self::Spanned;
    fn inner_of(spanned: &Self::Spanned) -> &T;
    fn span_of(spanned: &Self::Spanned) -> &Self;
}
Expand description

A supertrait of Span that specifies how a value, usually an AST node, might have a span attached to it.

The type for which this trait is implemented is the span type, and the T is the value type.

Required Associated Types§

Source

type Spanned

The type of a node after being wrapped in a span.

Required Methods§

Source

fn make_wrapped(self, inner: T) -> Self::Spanned

Wrap a node in a span.

Source

fn inner_of(spanned: &Self::Spanned) -> &T

Retrieve the inner value after it has been spanned.

Source

fn span_of(spanned: &Self::Spanned) -> &Self

Retrieve the span of a spanned 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, U: Clone, C: Clone> WrappingSpan<T> for SimpleSpan<U, C>