pub struct OpenClause {
pub namespace: Name,
pub only: Option<Vec<Name>>,
pub hiding: Vec<Name>,
pub renaming: Vec<(Name, Name)>,
}Expand description
One open clause: a namespace, and WHICH of its names it brings in, under WHICH spelling.
Lean’s four forms (Lean/Elab/Open.lean:63-96), and they are not sugar for one another:
Open Alpha. brings in all of them; Open Alpha (a b). brings in exactly those two;
Open Alpha hiding (a). brings in the rest; Open Alpha renaming a -> b. brings in a under
the local spelling b and brings in nothing else. Opening a namespace WHOLESALE is what makes
short names ambiguous in the first place, so the three narrowing forms are the tools for
AVOIDING an ambiguity rather than being told about one — and renaming is the only one of
them that can bring in a name whose short spelling already means something else here.
Fields§
§namespace: NameThe namespace. As written when the clause is parsed; resolved against the current namespace when it is applied.
only: Option<Vec<Name>>Open Alpha (a b). — ONLY these names are brought in. None is the wholesale opening.
hiding: Vec<Name>Open Alpha hiding (a b). — every name EXCEPT these.
renaming: Vec<(Name, Name)>Open Alpha renaming a -> b. — (the member, the local spelling). A clause with any
renaming brings in EXACTLY these, which is why it is its own form and not a modifier on the
others: Lean’s renaming arm emits only OpenDecl.explicit entries and no simple open
(Lean/Elab/Open.lean:89-96), so open Baz renaming orig → ali leaves untouched
unknown.
Implementations§
Source§impl OpenClause
impl OpenClause
Sourcepub fn all(namespace: Name) -> OpenClause
pub fn all(namespace: Name) -> OpenClause
Open Alpha. — the wholesale opening.
Trait Implementations§
Source§impl Clone for OpenClause
impl Clone for OpenClause
Source§fn clone(&self) -> OpenClause
fn clone(&self) -> OpenClause
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenClause
impl Debug for OpenClause
Source§impl PartialEq for OpenClause
impl PartialEq for OpenClause
impl Eq for OpenClause
impl StructuralPartialEq for OpenClause
Auto Trait Implementations§
impl Freeze for OpenClause
impl RefUnwindSafe for OpenClause
impl Send for OpenClause
impl Sync for OpenClause
impl Unpin for OpenClause
impl UnsafeUnpin for OpenClause
impl UnwindSafe for OpenClause
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.