Merge pull request #465 from andrewbaxter/field-mask-pub-value

Make field mask inner public
This commit is contained in:
Sebastian Thiel
2024-01-06 11:16:43 +01:00
committed by GitHub

View File

@@ -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