pub struct Binding { /* private fields */ }Expand description
The result of ParamList::bind: what each parameter receives, and the
presence mask.
§Examples
use bytecode_lang::{ArgItem, Bound, ModuleBuilder, Param, ParamKind, ParamList};
let module = ModuleBuilder::new().finish().unwrap();
let list = ParamList::new(vec![Param::new(ParamKind::PositionalOnly, None)]);
let b = list.bind(&module, &[ArgItem::Positional]).unwrap();
assert_eq!(b.slots(), &[Bound::Arg(0)]);
assert_eq!(b.presence(), 1);Implementations§
Source§impl Binding
impl Binding
Sourcepub fn slots(&self) -> &[Bound]
pub fn slots(&self) -> &[Bound]
What each parameter receives, in parameter order.
§Examples
use bytecode_lang::{ModuleBuilder, ParamList};
let module = ModuleBuilder::new().finish().unwrap();
assert!(ParamList::new(vec![]).bind(&module, &[]).unwrap().slots().is_empty());Sourcepub fn presence(&self) -> u64
pub fn presence(&self) -> u64
The presence mask: bit i is set when parameter i received an
argument (for a rest parameter, at least one).
§Examples
use bytecode_lang::{ModuleBuilder, Param, ParamList, StrId};
let mut m = ModuleBuilder::new();
let x = m.string("x");
let module = m.finish().unwrap();
let list = ParamList::new(vec![Param::normal(x).with_default()]);
assert_eq!(list.bind(&module, &[]).unwrap().presence(), 0);Trait Implementations§
impl Eq for Binding
impl StructuralPartialEq for Binding
Auto Trait Implementations§
impl Freeze for Binding
impl RefUnwindSafe for Binding
impl Send for Binding
impl Sync for Binding
impl Unpin for Binding
impl UnsafeUnpin for Binding
impl UnwindSafe for Binding
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