pub struct Definition<T> { /* private fields */ }Expand description
Nested namespace structure.
There are a lot of things “weird” about this structure, because Substrait is defined horribly; everything is a valid identifier (including identifiers with periods in them, so a period is ambiguous between a namespace separator and just part of an identifier), matching is case-insensitive (but for the validator we do want to store what the user’s case convention was for a definition), and for type variations names need not even be unique (arguably there’s a different variation namespace for each type class, but the type class isn’t yet known when a type variation anchor is defined, and that’s where we want to resolve the name; see https://github.com/substrait-io/substrait/issues/268).
So here we have an abomination of a namespace system that allows for name conflicts and period ambiguity and just tries to deal with it as cleanly as it can.
Implementations§
Source§impl<T> Definition<T>
impl<T> Definition<T>
Sourcepub fn define_item<S: AsRef<str>>(
&mut self,
name: S,
item: Arc<T>,
public: bool,
)
pub fn define_item<S: AsRef<str>>( &mut self, name: S, item: Arc<T>, public: bool, )
Defines an item with the given (case-insensitive) name. If an item going by a conflicting name already existed, the new item is inserted anyway; if the caller is concerned about that, it must first resolve the name and throw a warning or error based on its result.
Sourcepub fn define_nested<S: AsRef<str>>(
&mut self,
name: S,
item: Option<Reference<T>>,
public: bool,
)
pub fn define_nested<S: AsRef<str>>( &mut self, name: S, item: Option<Reference<T>>, public: bool, )
Registers a nested namespace with the given (case-insensitive) name. Same rules for duplicates as define_item(). If None is specified for item, the namespace reference is registered, but its contents are left unspecified.
Sourcepub fn resolve_local<R>(&self, reference: R) -> ResolutionResult<T>
pub fn resolve_local<R>(&self, reference: R) -> ResolutionResult<T>
Resolves a name to all items with the same name visible from within this namespace (so, including private items).
Sourcepub fn resolve_public<R>(&self, reference: R) -> ResolutionResult<T>
pub fn resolve_public<R>(&self, reference: R) -> ResolutionResult<T>
Resolves a name to all items with the same name visible from outside this namespace (so, excluding private items).
Trait Implementations§
Source§impl<T> Clone for Definition<T>
impl<T> Clone for Definition<T>
Source§impl<T: Debug> Debug for Definition<T>
impl<T: Debug> Debug for Definition<T>
Auto Trait Implementations§
impl<T> Freeze for Definition<T>
impl<T> RefUnwindSafe for Definition<T>where
T: RefUnwindSafe,
impl<T> Send for Definition<T>
impl<T> Sync for Definition<T>
impl<T> Unpin for Definition<T>
impl<T> UnwindSafe for Definition<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more