automerge/rust/automerge/src/transaction/commit.rs
Alex Good dd3c6d1303
Move rust workspace into ./rust
After some discussion with PVH I realise that the repo structure in the
last reorg was very rust-centric. In an attempt to put each language on
a level footing move the rust code and project files into ./rust
2022-10-16 19:55:51 +01:00

32 lines
820 B
Rust

/// Optional metadata for a commit.
#[derive(Debug, Default)]
pub struct CommitOptions {
pub message: Option<String>,
pub time: Option<i64>,
}
impl CommitOptions {
/// Add a message to the commit.
pub fn with_message<S: Into<String>>(mut self, message: S) -> Self {
self.message = Some(message.into());
self
}
/// Add a message to the commit.
pub fn set_message<S: Into<String>>(&mut self, message: S) -> &mut Self {
self.message = Some(message.into());
self
}
/// Add a timestamp to the commit.
pub fn with_time(mut self, time: i64) -> Self {
self.time = Some(time);
self
}
/// Add a timestamp to the commit.
pub fn set_time(&mut self, time: i64) -> &mut Self {
self.time = Some(time);
self
}
}