pub struct PromptRepository { /* private fields */ }Expand description
An append-only store of prompt versions with diff, rollback, and blame support.
Implementations§
Source§impl PromptRepository
impl PromptRepository
Sourcepub fn commit(&mut self, content: &str, author: &str, message: &str) -> u32
pub fn commit(&mut self, content: &str, author: &str, message: &str) -> u32
Commit new content and return the assigned version number.
Sourcepub fn checkout(&self, version: u32) -> Option<&PromptVersion>
pub fn checkout(&self, version: u32) -> Option<&PromptVersion>
Return a reference to the PromptVersion with the given number, if it exists.
Sourcepub fn diff(&self, from: u32, to: u32) -> Option<PromptDiff>
pub fn diff(&self, from: u32, to: u32) -> Option<PromptDiff>
Compute the diff between two committed versions.
Returns None if either version does not exist.
Sourcepub fn log(&self) -> Vec<&PromptVersion>
pub fn log(&self) -> Vec<&PromptVersion>
Return all versions in chronological (ascending version number) order.
Sourcepub fn rollback(&mut self, to_version: u32) -> Option<u32>
pub fn rollback(&mut self, to_version: u32) -> Option<u32>
Create a new commit whose content matches to_version, effectively
reverting to that state. Returns the new version number, or None if
to_version does not exist.
Sourcepub fn blame(&self, line: usize) -> Option<&PromptVersion>
pub fn blame(&self, line: usize) -> Option<&PromptVersion>
Return the version that last introduced (or modified) the given 0-based line index in the current HEAD content.
Iterates versions in reverse order and returns the first version where
the specified line differs from its parent. Returns None if the
repository is empty or the line index is out of range.
Return all versions committed by author, in chronological order.
Trait Implementations§
Source§impl Debug for PromptRepository
impl Debug for PromptRepository
Source§impl Default for PromptRepository
impl Default for PromptRepository
Source§fn default() -> PromptRepository
fn default() -> PromptRepository
Auto Trait Implementations§
impl Freeze for PromptRepository
impl RefUnwindSafe for PromptRepository
impl Send for PromptRepository
impl Sync for PromptRepository
impl Unpin for PromptRepository
impl UnsafeUnpin for PromptRepository
impl UnwindSafe for PromptRepository
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request