pub enum ContextTarget {
File {
path: String,
},
State {
change_id: ChangeId,
},
}Expand description
A typed target for context entries.
Variants§
Implementations§
Source§impl ContextTarget
impl ContextTarget
Sourcepub fn file(path: impl Into<String>) -> Result<Self, ContextError>
pub fn file(path: impl Into<String>) -> Result<Self, ContextError>
Construct a file-scope target. The path must be non-empty,
relative, and walkable — it’s stored inside the context tree
under __files/<path>, and the downstream writer’s
split_path helper only understands Component::Normal (no
RootDir, no ParentDir, no CurDir-only trails).
Previously this accepted any non-empty string, which meant
absolute paths like /Users/me/repo/src/auth.rs got all the
way to Repository::set_context_blob before failing with a
cryptic "empty path" error deep in the tree-insert routine.
Rejecting here turns that into a clear
AbsoluteTargetPath/InvalidTargetPath at the callsite.
pub fn state(change_id: ChangeId) -> Self
pub fn validate_scope( &self, scope: &AnnotationScope, ) -> Result<(), ContextError>
pub fn storage_path(&self) -> PathBuf
pub fn legacy_storage_path(&self) -> Option<PathBuf>
pub fn from_storage_path(path: &Path) -> Option<Self>
pub fn path(&self) -> Option<&str>
pub fn state_id(&self) -> Option<ChangeId>
Trait Implementations§
Source§impl Clone for ContextTarget
impl Clone for ContextTarget
Source§fn clone(&self) -> ContextTarget
fn clone(&self) -> ContextTarget
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 ContextTarget
impl Debug for ContextTarget
Source§impl<'de> Deserialize<'de> for ContextTarget
impl<'de> Deserialize<'de> for ContextTarget
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 ContextTarget
Source§impl Hash for ContextTarget
impl Hash for ContextTarget
Source§impl PartialEq for ContextTarget
impl PartialEq for ContextTarget
Source§fn eq(&self, other: &ContextTarget) -> bool
fn eq(&self, other: &ContextTarget) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ContextTarget
impl Serialize for ContextTarget
impl StructuralPartialEq for ContextTarget
Auto Trait Implementations§
impl Freeze for ContextTarget
impl RefUnwindSafe for ContextTarget
impl Send for ContextTarget
impl Sync for ContextTarget
impl Unpin for ContextTarget
impl UnsafeUnpin for ContextTarget
impl UnwindSafe for ContextTarget
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