diff --git a/google-apis-common/src/field_mask.rs b/google-apis-common/src/field_mask.rs index f84dcf4f10..3d8220a921 100644 --- a/google-apis-common/src/field_mask.rs +++ b/google-apis-common/src/field_mask.rs @@ -34,6 +34,14 @@ fn snakecase(source: &str) -> String { #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct FieldMask(Vec); +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>(values: &[S]) -> Self { + return Self(values.iter().map(|s| snakecase(s.as_ref())).collect()); + } +} + impl Serialize for FieldMask { fn serialize(&self, s: S) -> Result where