Struct marker_api::ast::Visibility
source · #[repr(C)]pub struct Visibility<'ast> { /* private fields */ }Expand description
The declared visibility of an item or field.
Note that this is only the syntactic visibility. The item or field might be reexported with a higher visibility, or have a high default visibility.
// An item without a visibility
fn moon() {}
// A public item
pub fn sun() {}
// An item with a restricted scope
pub(crate) fn star() {}
pub trait Planet {
// An item without a visibility. But it still has the semantic visibility
// of `pub` as this is inside a trait declaration.
fn mass();
}Implementations§
source§impl<'ast> Visibility<'ast>
impl<'ast> Visibility<'ast>
sourcepub fn semantics(&self) -> &Visibility<'ast>
pub fn semantics(&self) -> &Visibility<'ast>
This function returns the semantic representation for the Visibility
of this item. That visibility can be used to check if the item is public
or restricted to specific modules.
Trait Implementations§
Auto Trait Implementations§
impl<'ast> RefUnwindSafe for Visibility<'ast>
impl<'ast> Send for Visibility<'ast>
impl<'ast> Sync for Visibility<'ast>
impl<'ast> Unpin for Visibility<'ast>
impl<'ast> UnwindSafe for Visibility<'ast>
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