pub enum ClassScope {
Lexical,
BodyOnly,
Qualified,
}Expand description
What code nested in a class can see of the class’s members unqualified.
§Examples
use resolve_lang::{ClassScope, Policy};
assert_eq!(Policy::python().class_scope(), ClassScope::BodyOnly);
assert_eq!(Policy::php().class_scope(), ClassScope::Qualified);Variants§
Lexical
Members are in lexical scope everywhere inside the class, methods
included (Java, C++, Kraken). Only the class’s own members are seen
unqualified; inherited members go through self::/type-directed
lookup.
BodyOnly
Members are visible to the class body’s own initializers but not inside methods, lambdas, or nested classes (Python).
Qualified
Members are never visible unqualified; code writes self::x,
static::x, or $this->x (PHP).
Trait Implementations§
Source§impl Clone for ClassScope
impl Clone for ClassScope
impl Copy for ClassScope
Source§impl Debug for ClassScope
impl Debug for ClassScope
impl Eq for ClassScope
Source§impl Hash for ClassScope
impl Hash for ClassScope
Source§impl PartialEq for ClassScope
impl PartialEq for ClassScope
impl StructuralPartialEq for ClassScope
Auto Trait Implementations§
impl Freeze for ClassScope
impl RefUnwindSafe for ClassScope
impl Send for ClassScope
impl Sync for ClassScope
impl Unpin for ClassScope
impl UnsafeUnpin for ClassScope
impl UnwindSafe for ClassScope
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