pub struct ExecutableName { /* private fields */ }Expand description
A validated executable or binary name.
Implementations§
Source§impl ExecutableName
impl ExecutableName
Sourcepub fn new(name: impl Into<String>) -> Result<ExecutableName, CommandNameError>
pub fn new(name: impl Into<String>) -> Result<ExecutableName, CommandNameError>
Creates a validated executable name.
§Errors
Returns CommandNameError when name is not a valid command name.
Sourcepub fn from_path(
path: impl AsRef<Path>,
) -> Result<ExecutableName, CommandNameError>
pub fn from_path( path: impl AsRef<Path>, ) -> Result<ExecutableName, CommandNameError>
Extracts a validated executable name from a path.
§Errors
Returns CommandNameError when the path has no file name, the file name is not Unicode,
or the file name is not a valid command name.
Sourcepub const fn command_name(&self) -> &CommandName
pub const fn command_name(&self) -> &CommandName
Returns the executable name as a command name.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
Returns the display name.
Sourcepub fn into_command_name(self) -> CommandName
pub fn into_command_name(self) -> CommandName
Returns the owned executable name.
Trait Implementations§
Source§impl Clone for ExecutableName
impl Clone for ExecutableName
Source§fn clone(&self) -> ExecutableName
fn clone(&self) -> ExecutableName
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ExecutableName
impl Debug for ExecutableName
Source§impl Display for ExecutableName
impl Display for ExecutableName
Source§impl Hash for ExecutableName
impl Hash for ExecutableName
Source§impl PartialEq for ExecutableName
impl PartialEq for ExecutableName
Source§fn eq(&self, other: &ExecutableName) -> bool
fn eq(&self, other: &ExecutableName) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for ExecutableName
impl StructuralPartialEq for ExecutableName
Auto Trait Implementations§
impl Freeze for ExecutableName
impl RefUnwindSafe for ExecutableName
impl Send for ExecutableName
impl Sync for ExecutableName
impl Unpin for ExecutableName
impl UnsafeUnpin for ExecutableName
impl UnwindSafe for ExecutableName
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