Enum rune::ast::Visibility[][src]

pub enum Visibility {
    Inherited,
    Public(Pub),
    Crate(VisibilityRestrict<Crate>),
    Super(VisibilityRestrict<Super>),
    SelfValue(VisibilityRestrict<SelfValue>),
    In(VisibilityRestrict<VisibilityIn>),
}

Visibility level restricted to some path: pub(self) or pub(super) or pub(crate) or pub(in some::module).

Variants

Inherited

An inherited visibility level, this usually means private.

Public(Pub)

An unrestricted public visibility level: pub.

Crate(VisibilityRestrict<Crate>)

Crate visibility pub(crate).

Super(VisibilityRestrict<Super>)

Super visibility pub(super).

SelfValue(VisibilityRestrict<SelfValue>)

Self visibility pub(self).

In(VisibilityRestrict<VisibilityIn>)

In visibility pub(in path).

Implementations

impl Visibility[src]

pub const fn is_inherited(&self) -> bool[src]

Return true if it is the Inherited variant

pub const fn is_public(&self) -> bool[src]

Return true if the module is public.

Trait Implementations

impl Clone for Visibility[src]

impl Debug for Visibility[src]

impl Default for Visibility[src]

impl Eq for Visibility[src]

impl OptionSpanned for Visibility[src]

impl Parse for Visibility[src]

Parsing Visibility specifiers

Examples

use rune::{testing, ast};

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub"),
    ast::Visibility::Public(_)
});

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub (in a::b::c)"),
    ast::Visibility::In(_)
});

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub(in crate::x::y::z)"),
    ast::Visibility::In(_)
});

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub(super)"),
    ast::Visibility::Super(_)
});

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub(crate)"),
    ast::Visibility::Crate(_)
});

assert!(matches!{
    testing::roundtrip::<ast::Visibility>("pub(self)"),
    ast::Visibility::SelfValue(_)
});

impl PartialEq<Visibility> for Visibility[src]

impl StructuralEq for Visibility[src]

impl StructuralPartialEq for Visibility[src]

impl ToTokens for Visibility[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.