MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / update_message

Method update_message

crates/opencode-session/src/session.rs:482–493  ·  view source on GitHub ↗

Update a message by replacing it entirely

(&mut self, msg: SessionMessage)

Source from the content-addressed store, hash-verified

480
481 /// Update a message by replacing it entirely
482 pub fn update_message(&mut self, msg: SessionMessage) -> Option<&SessionMessage> {
483 if let Some(pos) = self.messages.iter().position(|m| m.id == msg.id) {
484 self.messages[pos] = msg;
485 self.touch();
486 Some(&self.messages[pos])
487 } else {
488 // New message - append
489 self.messages.push(msg);
490 self.touch();
491 self.messages.last()
492 }
493 }
494
495 /// Update a specific part within a message
496 pub fn update_part(&mut self, msg_id: &str, part: MessagePart) -> Option<&MessagePart> {

Callers 3

test_update_messageFunction · 0.45
test_update_message_newFunction · 0.45

Calls 4

publish_message_eventMethod · 0.80
touchMethod · 0.45
get_mutMethod · 0.45
cloneMethod · 0.45

Tested by 2

test_update_messageFunction · 0.36
test_update_message_newFunction · 0.36