pub struct Export {
pub res: Res,
pub kind: DefKind,
pub vis: Vis,
}Expand description
A name the environment exports: what it resolves to, its kind, and who may see it.
§Examples
use hir_lang::{Prim, Res, Vis};
use resolve_lang::{DefKind, Export};
let int = Export::new(Res::Prim(Prim::I64), DefKind::Prim);
assert_eq!(int.vis, Vis::Public);Fields§
§res: ResThe resolution a path naming it gets.
kind: DefKindIts kind.
vis: VisIts visibility. The environment filters what a unit may see; anything
but Public is reported as an access error from another unit.
Implementations§
Source§impl Export
impl Export
Sourcepub const fn new(res: Res, kind: DefKind) -> Self
pub const fn new(res: Res, kind: DefKind) -> Self
A public export.
§Examples
use hir_lang::{Res, Symbol};
use resolve_lang::{DefKind, Export};
let sym = Symbol::from_u32(1).unwrap();
let e = Export::new(Res::Extern(sym), DefKind::Extern);
assert_eq!(e.kind, DefKind::Extern);Sourcepub const fn with_vis(self, vis: Vis) -> Self
pub const fn with_vis(self, vis: Vis) -> Self
The same export with visibility vis.
§Examples
use hir_lang::{Res, Symbol, Vis};
use resolve_lang::{DefKind, Export};
let sym = Symbol::from_u32(1).unwrap();
let e = Export::new(Res::Extern(sym), DefKind::Extern).with_vis(Vis::Package);
assert_eq!(e.vis, Vis::Package);Trait Implementations§
impl Copy for Export
impl Eq for Export
impl StructuralPartialEq for Export
Auto Trait Implementations§
impl Freeze for Export
impl RefUnwindSafe for Export
impl Send for Export
impl Sync for Export
impl Unpin for Export
impl UnsafeUnpin for Export
impl UnwindSafe for Export
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