pub enum Visibility {
Public,
PubCrate,
PubSuper,
PubIn,
Private,
}Expand description
Visibility level of a Rust item
This is used to determine if access to an item from another module constitutes “Intrusive” coupling (access to private/internal details).
Variants§
Public
Fully public (pub)
PubCrate
Crate-internal (pub(crate))
PubSuper
Super-module visible (pub(super))
PubIn
Module-path restricted (pub(in path))
Private
Private (no visibility modifier)
Implementations§
Source§impl Visibility
impl Visibility
Sourcepub fn allows_external_access(&self) -> bool
pub fn allows_external_access(&self) -> bool
Check if this visibility allows access from a different module
Sourcepub fn is_intrusive_from(&self, same_crate: bool, same_module: bool) -> bool
pub fn is_intrusive_from(&self, same_crate: bool, same_module: bool) -> bool
Check if access from another module would be “intrusive”
Intrusive access means accessing something that isn’t part of the public API. This indicates tight coupling to implementation details.
Sourcepub fn intrusive_penalty(&self) -> f64
pub fn intrusive_penalty(&self) -> f64
Get a penalty multiplier for coupling strength based on visibility
Higher penalty = more “intrusive” the access is.
Trait Implementations§
Source§impl Clone for Visibility
impl Clone for Visibility
Source§fn clone(&self) -> Visibility
fn clone(&self) -> Visibility
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Visibility
impl Debug for Visibility
Source§impl Default for Visibility
impl Default for Visibility
Source§fn default() -> Visibility
fn default() -> Visibility
Returns the “default value” for a type. Read more
Source§impl Display for Visibility
impl Display for Visibility
Source§impl Hash for Visibility
impl Hash for Visibility
Source§impl PartialEq for Visibility
impl PartialEq for Visibility
impl Copy for Visibility
impl Eq for Visibility
impl StructuralPartialEq for Visibility
Auto Trait Implementations§
impl Freeze for Visibility
impl RefUnwindSafe for Visibility
impl Send for Visibility
impl Sync for Visibility
impl Unpin for Visibility
impl UnsafeUnpin for Visibility
impl UnwindSafe for Visibility
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more