pub struct Alternative { /* private fields */ }Expand description
One declared alternative at a site: which operator family produced it, the semantic bytes that identify the operation, and the value it means.
The bytes and the meaning travel together because they are one statement. A rendering that carried the meaning without the bytes would emit a value nothing could select, and one that carried the bytes without the meaning would select a value nothing renders.
Implementations§
Source§impl Alternative
impl Alternative
Sourcepub fn stated(
family: FamilySlug,
operation: Vec<u8>,
meaning: Vec<GeneratedToken>,
) -> Result<Self, DeclarationError>
pub fn stated( family: FamilySlug, operation: Vec<u8>, meaning: Vec<GeneratedToken>, ) -> Result<Self, DeclarationError>
Declare one alternative at a site.
§Errors
Returns DeclarationError::Absent where the operation carries no bytes: an alternative that identifies no operation is one nothing can select.
Sourcepub const fn family(&self) -> &FamilySlug
pub const fn family(&self) -> &FamilySlug
The operator family this alternative belongs to.
Sourcepub fn meaning(&self) -> &[GeneratedToken]
pub fn meaning(&self) -> &[GeneratedToken]
The value this alternative means, as the tokens that spell it.
Trait Implementations§
Source§impl Clone for Alternative
impl Clone for Alternative
Source§fn clone(&self) -> Alternative
fn clone(&self) -> Alternative
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Alternative
impl Debug for Alternative
impl Eq for Alternative
Source§impl Hash for Alternative
impl Hash for Alternative
Source§impl PartialEq for Alternative
impl PartialEq for Alternative
impl StructuralPartialEq for Alternative
Auto Trait Implementations§
impl Freeze for Alternative
impl RefUnwindSafe for Alternative
impl Send for Alternative
impl Sync for Alternative
impl Unpin for Alternative
impl UnsafeUnpin for Alternative
impl UnwindSafe for Alternative
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more