Trait SetOnce

Source
pub(crate) trait SetOnce<T> {
    // Required methods
    fn set_once(&mut self, value: T, span: Span);
    fn value(self) -> Option<T>;
    fn value_ref(&self) -> Option<&T>;
}
Expand description

Small helper trait for abstracting over Option fields that contain a value and a Span for error reporting if they are set more than once.

Required Methods§

Source

fn set_once(&mut self, value: T, span: Span)

Source

fn value(self) -> Option<T>

Source

fn value_ref(&self) -> Option<&T>

Implementations on Foreign Types§

Source§

impl<T> SetOnce<T> for Option<(T, Span)>

Source§

fn set_once(&mut self, value: T, span: Span)

Source§

fn value(self) -> Option<T>

Source§

fn value_ref(&self) -> Option<&T>

Implementors§