pub struct RepoPath(/* private fields */);Expand description
A repository-relative path that cannot escape the workspace root.
Implementations§
Source§impl RepoPath
impl RepoPath
Sourcepub fn new(value: impl Into<String>) -> Result<Self, DomainTypeError>
pub fn new(value: impl Into<String>) -> Result<Self, DomainTypeError>
Creates a validated repository-relative path.
RepoPath rejects empty values, absolute paths, and any path that tries
to escape the workspace with ...
§Errors
Returns DomainTypeError when the value is empty, absolute, or
contains parent-directory traversal.
§Examples
use agent_domain::RepoPath;
let path = RepoPath::new("crates/agent-cli/src/main.rs")?;
assert_eq!(path.as_str(), "crates/agent-cli/src/main.rs");Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes the value object and returns the inner string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RepoPath
impl<'de> Deserialize<'de> for RepoPath
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 Ord for RepoPath
impl Ord for RepoPath
Source§impl PartialOrd for RepoPath
impl PartialOrd for RepoPath
impl Eq for RepoPath
impl StructuralPartialEq for RepoPath
Auto Trait Implementations§
impl Freeze for RepoPath
impl RefUnwindSafe for RepoPath
impl Send for RepoPath
impl Sync for RepoPath
impl Unpin for RepoPath
impl UnsafeUnpin for RepoPath
impl UnwindSafe for RepoPath
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