pub struct ProjectMarker(/* private fields */);Expand description
The file or directory name whose presence marks a project root, such as
Cargo.toml.
Exactly one file name: an absolute path would always match and a multi-component path would match at the workspace root but never deeper. Deserializes from a TOML string and rejects both at load time.
§Examples
use mcpls_core::config::ProjectMarker;
assert_eq!(ProjectMarker::new("Cargo.toml").unwrap(), "Cargo.toml");
assert!(ProjectMarker::new("/etc/hosts").is_err());
assert!(ProjectMarker::new("src/lib.rs").is_err());
assert!(ProjectMarker::new("..").is_err());Implementations§
Source§impl ProjectMarker
impl ProjectMarker
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, InvalidProjectMarker>
pub fn new(text: impl Into<String>) -> Result<Self, InvalidProjectMarker>
Builds the value from any string.
§Errors
Returns InvalidProjectMarker naming the first rule text breaks.
Trait Implementations§
Source§impl AsRef<str> for ProjectMarker
impl AsRef<str> for ProjectMarker
Source§impl Borrow<str> for ProjectMarker
impl Borrow<str> for ProjectMarker
Source§impl Clone for ProjectMarker
impl Clone for ProjectMarker
Source§impl Debug for ProjectMarker
impl Debug for ProjectMarker
Source§impl<'de> Deserialize<'de> for ProjectMarker
impl<'de> Deserialize<'de> for ProjectMarker
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
Source§impl Display for ProjectMarker
impl Display for ProjectMarker
impl Eq for ProjectMarker
Source§impl From<ProjectMarker> for String
impl From<ProjectMarker> for String
Source§fn from(value: ProjectMarker) -> Self
fn from(value: ProjectMarker) -> Self
Converts to this type from the input type.
Source§impl FromStr for ProjectMarker
impl FromStr for ProjectMarker
Source§impl Hash for ProjectMarker
impl Hash for ProjectMarker
Source§impl PartialEq for ProjectMarker
impl PartialEq for ProjectMarker
Source§impl PartialEq<&str> for ProjectMarker
impl PartialEq<&str> for ProjectMarker
Source§impl PartialEq<str> for ProjectMarker
impl PartialEq<str> for ProjectMarker
Source§impl Serialize for ProjectMarker
impl Serialize for ProjectMarker
impl StructuralPartialEq for ProjectMarker
Auto Trait Implementations§
impl Freeze for ProjectMarker
impl RefUnwindSafe for ProjectMarker
impl Send for ProjectMarker
impl Sync for ProjectMarker
impl Unpin for ProjectMarker
impl UnsafeUnpin for ProjectMarker
impl UnwindSafe for ProjectMarker
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.