Skip to content

Commit

Permalink
Merge pull request #465 from andrewbaxter/field-mask-pub-value
Browse files Browse the repository at this point in the history
Make field mask inner public
  • Loading branch information
Byron authored Jan 6, 2024
2 parents 5a190c7 + d09893e commit 00a3e18
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions google-apis-common/src/field_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ fn snakecase(source: &str) -> String {
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct FieldMask(Vec<String>);

impl FieldMask {
/// Create a new `FieldMask` from a list of paths. These are converted to snake
/// case if they aren't already.
pub fn new<S: AsRef<str>>(values: &[S]) -> Self {
return Self(values.iter().map(|s| snakecase(s.as_ref())).collect());
}
}

impl Serialize for FieldMask {
fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where
Expand Down

0 comments on commit 00a3e18

Please sign in to comment.