MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / read_actor

Method read_actor

atomic-core/src/operation/codec.rs:1301–1323  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

1299 }
1300
1301 fn read_actor(&mut self) -> Result<ActorRef, OperationCodecError> {
1302 match self.read_u8()? {
1303 0 => Ok(ActorRef::Human {
1304 did: self.read_string("human actor DID")?,
1305 }),
1306 1 => {
1307 let did = self.read_string("agent actor DID")?;
1308 let session = self.read_string("agent session")?;
1309 let turn = if self.read_optional_tag("agent turn")? {
1310 Some(self.read_u64()?)
1311 } else {
1312 None
1313 };
1314 Ok(ActorRef::Agent { did, session, turn })
1315 }
1316 2 => Ok(ActorRef::System {
1317 name: self.read_string("system actor name")?,
1318 }),
1319 tag => Err(OperationCodecError::new(format!(
1320 "unsupported actor tag {tag}"
1321 ))),
1322 }
1323 }
1324
1325 fn read_loss_note(&mut self) -> Result<OperationLossNote, OperationCodecError> {
1326 let code = self.read_string("loss-note code")?;

Callers 1

decode_operationFunction · 0.80

Calls 4

read_u8Method · 0.80
read_optional_tagMethod · 0.80
read_u64Method · 0.80
read_stringMethod · 0.45

Tested by

no test coverage detected