Trait symtern::traits::Resolve
[−]
[src]
pub trait Resolve { type Input; type Output; fn resolve(self, symbol: Self::Input) -> Result<Self::Output>; }
Interface trait for types that provide the ability to resolve a symbol into its referent.
In order to allow for implementations that require a lifetime parameter,
this trait's methods take self
by value; for a given type T
, the trait
should implemented for &'a T
.
Associated Types
type Input
Type passed to the resolve
method.
type Output
Type stored by the interner and made available with resolve
.
Required Methods
fn resolve(self, symbol: Self::Input) -> Result<Self::Output>
Look up and return a reference to the value represented by a symbol, or an error if the symbol was not found.
let s = match some_pool.resolve(sym) { Ok(s) => s, Err(err) => return Err(MyErrorType::from(err)), };
Implementors
impl<'a, T: ?Sized, I> Resolve for &'a Pool<T, I> where T: ToOwned + Eq + Hash,
T::Owned: Eq + Hash + Borrow<T>,
I: SymbolIdimpl<'a, W, WS> Resolve for &'a Inline<W> where &'b W: Resolve<Input=WS, Output=&'b str>,
WS: 'a + Symbol,
WS::Id: Pack + SymbolIdimpl<'a, W, BI, BO: ?Sized> Resolve for &'a Luma<W> where &'b W: Resolve<Input=BI, Output=&'b BO>,
BI: Symbol + Symbol,
BO: 'a