pub struct AgentId(/* private fields */);Expand description
The namespace of the agent that produced a session, such as claude. The
caller chooses it; the library only requires lowercase ASCII letters,
digits and -, since it names a directory.
Implementations§
Source§impl AgentId
impl AgentId
Sourcepub fn new(id: impl Into<String>) -> Result<Self>
pub fn new(id: impl Into<String>) -> Result<Self>
Examples found in repository?
examples/inspect.rs (lines 10-12)
7fn main() -> Result<()> {
8 let mut args = std::env::args_os().skip(1);
9 let root = PathBuf::from(args.next().context("usage: inspect STORE_ROOT AGENT SESSION_ID")?);
10 let agent = AgentId::new(
11 args.next().context("missing agent")?.into_string().map_err(|_| anyhow::anyhow!("invalid agent"))?,
12 )?;
13 let session_id =
14 args.next().context("missing session ID")?.into_string().map_err(|_| anyhow::anyhow!("invalid session ID"))?;
15 anyhow::ensure!(args.next().is_none(), "unexpected argument");
16 let report = Store::new(root).read(&SessionKey { agent, session_id })?;
17 for warning in report.warnings {
18 eprintln!("{}: {}", warning.path.display(), warning.message);
19 }
20 println!("{}", serde_json::to_string_pretty(&files(report.events))?);
21 Ok(())
22}pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentId
impl<'de> Deserialize<'de> for AgentId
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 AgentId
Source§impl Ord for AgentId
impl Ord for AgentId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for AgentId
impl PartialOrd for AgentId
impl StructuralPartialEq for AgentId
Auto Trait Implementations§
impl Freeze for AgentId
impl RefUnwindSafe for AgentId
impl Send for AgentId
impl Sync for AgentId
impl Unpin for AgentId
impl UnsafeUnpin for AgentId
impl UnwindSafe for AgentId
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