pub struct Reset { /* private fields */ }Expand description
Reset HEAD to a target commit.
Three convenience constructors select the reset mode:
Reset::soft– move HEAD only (keep index and working directory)Reset::mixed– move HEAD and reset index (keep working directory)Reset::hard– move HEAD, reset index and working directory
§Examples
use ironflow_ops_git::reset::Reset;
use ironflow_core::operation::Operation;
let soft = Reset::soft("/path/to/repo", "abc123");
let mixed = Reset::mixed("/path/to/repo", "abc123");
let hard = Reset::hard("/path/to/repo", "abc123");
assert_eq!(soft.kind(), "git");Implementations§
Source§impl Reset
impl Reset
Sourcepub fn soft(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
pub fn soft(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
Soft reset (move HEAD, keep index and working directory).
Sourcepub fn mixed(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
pub fn mixed(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
Mixed reset (move HEAD and reset index, keep working directory).
Sourcepub fn hard(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
pub fn hard(repo_path: impl Into<PathBuf>, target: impl Into<String>) -> Self
Hard reset (move HEAD, reset index and working directory).
Sourcepub async fn run(
&self,
_ctx: &OperationContext,
) -> Result<ResetOutput, OperationError>
pub async fn run( &self, _ctx: &OperationContext, ) -> Result<ResetOutput, OperationError>
Execute and return a typed result.
Trait Implementations§
Source§impl Operation for Reset
impl Operation for Reset
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 OperationContext,
) -> Pin<Box<dyn Future<Output = Result<Value, OperationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the operation and return the result as JSON. Read more
Source§impl TypedOperation for Reset
impl TypedOperation for Reset
Source§type Output = ResetOutput
type Output = ResetOutput
The concrete output type that
Operation::execute produces.Auto Trait Implementations§
impl Freeze for Reset
impl RefUnwindSafe for Reset
impl Send for Reset
impl Sync for Reset
impl Unpin for Reset
impl UnsafeUnpin for Reset
impl UnwindSafe for Reset
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