pub struct LockfileDependencyRef {
pub source: Option<String>,
pub resource_type: ResourceType,
pub path: String,
pub version: Option<String>,
}Expand description
A structured representation of a lockfile dependency reference.
This type represents dependencies as they appear in agpm.lock files.
The format is compact and designed for lockfile serialization.
Supports the following formats:
- Local:
<type>:<path>(e.g.,snippet:snippets/commands/update-docstrings) - Git:
<source>/<type>:<path>@<version>(e.g.,agpm-resources/snippet:snippets/commands/update-docstrings@v0.0.1)
Examples:
use agpm_cli::lockfile::lockfile_dependency_ref::LockfileDependencyRef;
use agpm_cli::core::ResourceType;
use std::str::FromStr;
let local_dep = LockfileDependencyRef::from_str("snippet:snippets/commands/update-docstrings").unwrap();
assert_eq!(local_dep.source, None);
assert_eq!(local_dep.resource_type, ResourceType::Snippet);
assert_eq!(local_dep.path, "snippets/commands/update-docstrings");
assert_eq!(local_dep.version, None);
let git_dep = LockfileDependencyRef::from_str("agpm-resources/snippet:snippets/commands/update-docstrings@v0.0.1").unwrap();
assert_eq!(git_dep.source, Some("agpm-resources".to_string()));
assert_eq!(git_dep.resource_type, ResourceType::Snippet);
assert_eq!(git_dep.path, "snippets/commands/update-docstrings");
assert_eq!(git_dep.version, Some("v0.0.1".to_string()));Fields§
§source: Option<String>Optional source name (e.g., “agpm-resources”)
resource_type: ResourceTypeResource type (agent, snippet, command, etc.)
path: StringPath within the source repository (e.g., “snippets/commands/update-docstrings”)
version: Option<String>Optional version constraint (e.g., “v0.0.1”)
Implementations§
Source§impl LockfileDependencyRef
impl LockfileDependencyRef
Sourcepub fn new(
source: Option<String>,
resource_type: ResourceType,
path: String,
version: Option<String>,
) -> Self
pub fn new( source: Option<String>, resource_type: ResourceType, path: String, version: Option<String>, ) -> Self
Create a new lockfile dependency reference.
Trait Implementations§
Source§impl Clone for LockfileDependencyRef
impl Clone for LockfileDependencyRef
Source§fn clone(&self) -> LockfileDependencyRef
fn clone(&self) -> LockfileDependencyRef
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 LockfileDependencyRef
impl Debug for LockfileDependencyRef
Source§impl Display for LockfileDependencyRef
impl Display for LockfileDependencyRef
Source§impl FromStr for LockfileDependencyRef
impl FromStr for LockfileDependencyRef
Source§impl PartialEq for LockfileDependencyRef
impl PartialEq for LockfileDependencyRef
impl Eq for LockfileDependencyRef
impl StructuralPartialEq for LockfileDependencyRef
Auto Trait Implementations§
impl Freeze for LockfileDependencyRef
impl RefUnwindSafe for LockfileDependencyRef
impl Send for LockfileDependencyRef
impl Sync for LockfileDependencyRef
impl Unpin for LockfileDependencyRef
impl UnwindSafe for LockfileDependencyRef
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<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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.