core::origin
This commit is contained in:
parent
0b29b12eaa
commit
d09e99b112
12
src/core.rs
12
src/core.rs
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
mod addresses;
|
mod addresses;
|
||||||
mod hashing;
|
mod hashing;
|
||||||
|
mod origin;
|
||||||
mod point;
|
mod point;
|
||||||
mod points;
|
mod points;
|
||||||
mod resolution;
|
mod resolution;
|
||||||
@ -17,6 +18,7 @@ use crate::func::*;
|
|||||||
|
|
||||||
pub use self::addresses::*;
|
pub use self::addresses::*;
|
||||||
pub use self::hashing::*;
|
pub use self::hashing::*;
|
||||||
|
pub use self::origin::*;
|
||||||
pub use self::point::*;
|
pub use self::point::*;
|
||||||
pub use self::points::TakesPoints;
|
pub use self::points::TakesPoints;
|
||||||
pub use self::resolution::*;
|
pub use self::resolution::*;
|
||||||
@ -97,16 +99,6 @@ pub trait Factory<'a, Ctx: 'a + Context>: 'a + Send + Sync + Clone {
|
|||||||
fn unexpected_tail(&self, tail: &[u8]) -> Self::ParseError;
|
fn unexpected_tail(&self, tail: &[u8]) -> Self::ParseError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a potentially resolvable [`Mentionable`].
|
|
||||||
pub trait Origin<'a, Ctx: 'a + Context>: 'a {
|
|
||||||
/// Type of the associated object.
|
|
||||||
type Mtbl: Mentionable<'a, Ctx>;
|
|
||||||
/// Value of the associated factory.
|
|
||||||
fn factory(&self) -> <Self::Mtbl as Mentionable<'a, Ctx>>::Fctr;
|
|
||||||
/// Try resolving the value.
|
|
||||||
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Extension trait for factories.
|
/// Extension trait for factories.
|
||||||
pub trait ExtFactory<'a, Ctx: 'a + Context>: Factory<'a, Ctx> {
|
pub trait ExtFactory<'a, Ctx: 'a + Context>: Factory<'a, Ctx> {
|
||||||
/// Parse the object from a slice.
|
/// Parse the object from a slice.
|
||||||
|
11
src/core/origin.rs
Normal file
11
src/core/origin.rs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
/// Represents a potentially resolvable [`Mentionable`].
|
||||||
|
pub trait Origin<'a, Ctx: 'a + Context>: 'a {
|
||||||
|
/// Type of the associated object.
|
||||||
|
type Mtbl: Mentionable<'a, Ctx>;
|
||||||
|
/// Value of the associated factory.
|
||||||
|
fn factory(&self) -> <Self::Mtbl as Mentionable<'a, Ctx>>::Fctr;
|
||||||
|
/// Try resolving the value.
|
||||||
|
fn resolve(self: Rc<Self>) -> Resolution<'a, Ctx, Self::Mtbl>;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user