Skip to main content

IntoGitRef

Trait IntoGitRef 

Source
pub trait IntoGitRef {
    // Required method
    fn into_git_ref(self) -> GitRef;
}
Expand description

Trait for types that can be converted into a GitRef

This allows for flexible API design where methods can accept either:

  • String references (parsed at runtime)
  • Explicit GitRef enums (clear intent)
  • Direct Oids (type-safe, no ambiguity)

§Examples

ⓘ
// String reference (ergonomic)
worktree.checkout("main").await?;

// Explicit GitRef (clear intent)
worktree.checkout(GitRef::Branch("develop".into())).await?;

// Direct Oid (type-safe)
let oid = Oid::from_str("abc123...")?;
worktree.checkout(oid).await?;

Required Methods§

Source

fn into_git_ref(self) -> GitRef

Convert self into a GitRef

Implementations on Foreign Types§

Source§

impl IntoGitRef for &str

Source§

impl IntoGitRef for String

Implementors§