pub struct Param {
pub name: Option<StrId>,
pub kind: ParamKind,
pub by_ref: bool,
pub default: bool,
}Expand description
Fields§
§name: Option<StrId>The parameter’s name in the callee’s module. Required for
Normal and NamedOnly
parameters; optional (diagnostics only) for the others.
kind: ParamKindHow the parameter receives arguments.
by_ref: boolWhether the parameter takes its argument by reference (PHP
&$x): it receives a reference (kind reference) aliasing the
caller’s place instead of the value. For a rest parameter, every
collected argument is taken by reference.
default: boolWhether the parameter has a default, which the callee computes itself when the presence mask says no argument arrived. Never set on a rest parameter.
Implementations§
Source§impl Param
impl Param
Sourcepub const fn new(kind: ParamKind, name: Option<StrId>) -> Self
pub const fn new(kind: ParamKind, name: Option<StrId>) -> Self
A parameter of kind kind named name, by value, without default.
§Examples
use bytecode_lang::{Param, ParamKind};
assert_eq!(Param::new(ParamKind::Rest, None).kind, ParamKind::Rest);Sourcepub const fn by_ref(self) -> Self
pub const fn by_ref(self) -> Self
This parameter taking its argument by reference.
§Examples
use bytecode_lang::{Param, StrId};
assert!(Param::normal(StrId(0)).by_ref().by_ref);Sourcepub const fn with_default(self) -> Self
pub const fn with_default(self) -> Self
This parameter with a default.
§Examples
use bytecode_lang::{Param, StrId};
assert!(Param::normal(StrId(0)).with_default().default);Trait Implementations§
impl Copy for Param
impl Eq for Param
Source§impl Ord for Param
impl Ord for Param
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Param
impl PartialOrd for Param
impl StructuralPartialEq for Param
Auto Trait Implementations§
impl Freeze for Param
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnsafeUnpin for Param
impl UnwindSafe for Param
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