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

Method expect_state

atomic-core/src/change/format_v3/writer/helpers.rs:14–22  ·  view source on GitHub ↗

Check that the writer is in the expected state.

(&self, expected: WriterState, operation: &str)

Source from the content-addressed store, hash-verified

12impl<'w, W: Write> ChangeWriter<'w, W> {
13 /// Check that the writer is in the expected state.
14 pub(super) fn expect_state(&self, expected: WriterState, operation: &str) -> FormatResult<()> {
15 if self.state != expected {
16 return Err(FormatError::UnexpectedSection {
17 got: operation.to_string(),
18 expected: format!("state {}, but was {}", expected.name(), self.state.name()),
19 });
20 }
21 Ok(())
22 }
23
24 /// Ensure that the required metadata sections (HEADER + DEPS) have been written.
25 pub(super) fn ensure_metadata_complete(&self) -> FormatResult<()> {

Callers 2

write_file_headerMethod · 0.80
write_hash_tableMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected