pub struct BindingProfileModes {
pub scope: BindingScopeMode,
pub hygiene: HygieneMode,
}Expand description
The binding and hygiene modes selected for a language profile.
Parsed from profile options and consumed by the profile-modes form to
configure how a profile’s surface binds names.
Fields§
§scope: BindingScopeModeThe binding scope mode.
hygiene: HygieneModeThe macro hygiene mode.
Implementations§
Source§impl BindingProfileModes
impl BindingProfileModes
Sourcepub fn from_options(options: &[(Symbol, Expr)]) -> Result<Self>
pub fn from_options(options: &[(Symbol, Expr)]) -> Result<Self>
Derives modes from profile option pairs, defaulting unset modes.
Recognizes scope/binding keys for BindingScopeMode and
hygiene for HygieneMode; other keys are ignored. Errors on an
unknown mode symbol.
§Examples
use sim_kernel::{Expr, Symbol};
use sim_lib_binding::{BindingProfileModes, BindingScopeMode, HygieneMode};
let modes = BindingProfileModes::from_options(&[
(Symbol::new("scope"), Expr::Symbol(Symbol::new("dynamic"))),
(Symbol::new("hygiene"), Expr::Symbol(Symbol::new("explicit"))),
])
.unwrap();
assert_eq!(modes.scope, BindingScopeMode::Dynamic);
assert_eq!(modes.hygiene, HygieneMode::Explicit);Trait Implementations§
Source§impl Clone for BindingProfileModes
impl Clone for BindingProfileModes
Source§fn clone(&self) -> BindingProfileModes
fn clone(&self) -> BindingProfileModes
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 moreimpl Copy for BindingProfileModes
Source§impl Debug for BindingProfileModes
impl Debug for BindingProfileModes
Source§impl Default for BindingProfileModes
impl Default for BindingProfileModes
impl Eq for BindingProfileModes
Source§impl PartialEq for BindingProfileModes
impl PartialEq for BindingProfileModes
Source§fn eq(&self, other: &BindingProfileModes) -> bool
fn eq(&self, other: &BindingProfileModes) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BindingProfileModes
Auto Trait Implementations§
impl Freeze for BindingProfileModes
impl RefUnwindSafe for BindingProfileModes
impl Send for BindingProfileModes
impl Sync for BindingProfileModes
impl Unpin for BindingProfileModes
impl UnsafeUnpin for BindingProfileModes
impl UnwindSafe for BindingProfileModes
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