Skip to content

Commit

Permalink
state: add StateData constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Mar 4, 2025
1 parent 81907ba commit d8038b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ impl CommitEncode for StateData {
}
}

impl StateData {
pub fn new(value: impl Into<StateValue>) -> Self { Self { value: value.into(), raw: None } }

pub fn with(value: impl Into<StateValue>, raw: impl Into<RawData>) -> Self {
Self { value: value.into(), raw: Some(raw.into()) }
}
}

#[cfg(all(feature = "serde", feature = "baid64"))]
mod _serde {
use serde::de::Error;
Expand Down

0 comments on commit d8038b9

Please # to comment.