pub struct EditService;Expand description
Service for editing requirement items.
Implementations§
Source§impl EditService
impl EditService
Sourcepub fn lookup_item<'a>(
&self,
graph: &'a KnowledgeGraph,
item_id: &str,
) -> Result<&'a Item, EditError>
pub fn lookup_item<'a>( &self, graph: &'a KnowledgeGraph, item_id: &str, ) -> Result<&'a Item, EditError>
Looks up an item by ID with fuzzy suggestions on failure.
Sourcepub fn get_item_context(&self, item: &Item) -> ItemContext
pub fn get_item_context(&self, item: &Item) -> ItemContext
Gets the context for an item.
Sourcepub fn validate_options(
&self,
opts: &EditOptions,
item_type: ItemType,
) -> Result<(), EditError>
pub fn validate_options( &self, opts: &EditOptions, item_type: ItemType, ) -> Result<(), EditError>
Validates edit options against the item type.
Sourcepub fn merge_values(
&self,
opts: &EditOptions,
current: &ItemContext,
) -> EditedValues
pub fn merge_values( &self, opts: &EditOptions, current: &ItemContext, ) -> EditedValues
Merges edit options with current item values.
Sourcepub fn build_change_summary(
&self,
old: &ItemContext,
new: &EditedValues,
) -> Vec<FieldChange>
pub fn build_change_summary( &self, old: &ItemContext, new: &EditedValues, ) -> Vec<FieldChange>
Builds a change summary comparing old and new values.
Sourcepub fn apply_changes(
&self,
item_id: &str,
item_type: ItemType,
new_values: &EditedValues,
file_path: &PathBuf,
) -> Result<(), EditError>
pub fn apply_changes( &self, item_id: &str, item_type: ItemType, new_values: &EditedValues, file_path: &PathBuf, ) -> Result<(), EditError>
Applies changes to the file.
Sourcepub fn build_frontmatter_yaml(
&self,
item_id: &str,
item_type: ItemType,
values: &EditedValues,
) -> String
pub fn build_frontmatter_yaml( &self, item_id: &str, item_type: ItemType, values: &EditedValues, ) -> String
Builds YAML frontmatter string from edit values.
Sourcepub fn edit(
&self,
graph: &KnowledgeGraph,
opts: &EditOptions,
) -> Result<EditResult, EditError>
pub fn edit( &self, graph: &KnowledgeGraph, opts: &EditOptions, ) -> Result<EditResult, EditError>
Performs a non-interactive edit operation.
Trait Implementations§
Source§impl Debug for EditService
impl Debug for EditService
Source§impl Default for EditService
impl Default for EditService
Source§fn default() -> EditService
fn default() -> EditService
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EditService
impl RefUnwindSafe for EditService
impl Send for EditService
impl Sync for EditService
impl Unpin for EditService
impl UnwindSafe for EditService
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> 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 more