pub struct FileName(/* private fields */);Expand description
The name of an extensionless file such as Makefile or Dockerfile, as
Path::file_name reports it.
A name has no dot, so Path::extension never reports one for it and the
extension and name maps cannot both claim a file. Case is significant.
§Examples
use mcpls_core::config::FileName;
assert_eq!(FileName::new("Makefile").unwrap(), "Makefile");
assert!(FileName::new("Cargo.toml").is_err());
assert!(FileName::new(".eslintrc").is_err());Implementations§
Source§impl FileName
impl FileName
Sourcepub const fn from_static(text: &'static str) -> Self
pub const fn from_static(text: &'static str) -> Self
Builds the value from a literal, checked at compile time when
evaluated in a const context.
§Panics
Panics if the literal is not a valid value of this type.
Sourcepub fn new(text: impl Into<String>) -> Result<Self, InvalidFileName>
pub fn new(text: impl Into<String>) -> Result<Self, InvalidFileName>
Builds the value from any string.
§Errors
Returns InvalidFileName naming the first rule text breaks.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FileName
impl<'de> Deserialize<'de> for FileName
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FileName
impl StructuralPartialEq for FileName
Auto Trait Implementations§
impl Freeze for FileName
impl RefUnwindSafe for FileName
impl Send for FileName
impl Sync for FileName
impl Unpin for FileName
impl UnsafeUnpin for FileName
impl UnwindSafe for FileName
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.