Skip to content

Commit

Permalink
Add &mut accessors to LineMetaMut
Browse files Browse the repository at this point in the history
  • Loading branch information
c-nixon committed Apr 14, 2022
1 parent 69686ab commit 290e54e
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ pub trait LineMetaMut: LineMeta {
fn set_labels(&mut self, labels: KeyValueMap) -> Result<(), LineMetaError>;
fn set_level(&mut self, level: String) -> Result<(), LineMetaError>;
fn set_meta(&mut self, meta: Value) -> Result<(), LineMetaError>;
fn get_annotations_mut(&mut self) -> &mut Option<KeyValueMap>;
fn get_app_mut(&mut self) -> &mut Option<String>;
fn get_env_mut(&mut self) -> &mut Option<String>;
fn get_file_mut(&mut self) -> &mut Option<String>;
fn get_host_mut(&mut self) -> &mut Option<String>;
fn get_labels_mut(&mut self) -> &mut Option<KeyValueMap>;
fn get_level_mut(&mut self) -> &mut Option<String>;
fn get_meta_mut(&mut self) -> &mut Option<Value>;
}

/// Represents a line that provides accessor to the underlying data buffer for manipulation.
Expand Down Expand Up @@ -589,6 +597,30 @@ impl LineMetaMut for LineBuilder {
self.meta = Some(meta);
Ok(())
}
fn get_annotations_mut(&mut self) -> &mut Option<KeyValueMap> {
&mut self.annotations
}
fn get_app_mut(&mut self) -> &mut Option<String> {
&mut self.app
}
fn get_env_mut(&mut self) -> &mut Option<String> {
&mut self.env
}
fn get_file_mut(&mut self) -> &mut Option<String> {
&mut self.file
}
fn get_host_mut(&mut self) -> &mut Option<String> {
&mut self.host
}
fn get_labels_mut(&mut self) -> &mut Option<KeyValueMap> {
&mut self.labels
}
fn get_level_mut(&mut self) -> &mut Option<String> {
&mut self.level
}
fn get_meta_mut(&mut self) -> &mut Option<Value> {
&mut self.meta
}
}

impl LineBufferMut for LineBuilder {
Expand Down Expand Up @@ -639,6 +671,30 @@ impl LineMetaMut for &mut LineBuilder {
self.meta = Some(meta);
Ok(())
}
fn get_annotations_mut(&mut self) -> &mut Option<KeyValueMap> {
&mut self.annotations
}
fn get_app_mut(&mut self) -> &mut Option<String> {
&mut self.app
}
fn get_env_mut(&mut self) -> &mut Option<String> {
&mut self.env
}
fn get_file_mut(&mut self) -> &mut Option<String> {
&mut self.file
}
fn get_host_mut(&mut self) -> &mut Option<String> {
&mut self.host
}
fn get_labels_mut(&mut self) -> &mut Option<KeyValueMap> {
&mut self.labels
}
fn get_level_mut(&mut self) -> &mut Option<String> {
&mut self.level
}
fn get_meta_mut(&mut self) -> &mut Option<Value> {
&mut self.meta
}
}

impl LineBufferMut for &mut LineBuilder {
Expand Down

0 comments on commit 290e54e

Please sign in to comment.