Skip to main content

FieldConstraintsExt

Trait FieldConstraintsExt 

Source
pub trait FieldConstraintsExt {
    // Required methods
    fn field_constraints(&self) -> ConstraintDecodeResult<FieldRules>;
    fn real_oneof(&self) -> Option<OneofDescriptor>;
    fn is_optional(&self) -> bool;
}
Expand description

Extension trait for extracting buf.validate.field rules from a field descriptor.

Required Methods§

Source

fn field_constraints(&self) -> ConstraintDecodeResult<FieldRules>

Returns the FieldRules for this field, if any.

§Errors

Returns an error if the extension value cannot be transcoded to FieldRules.

Source

fn real_oneof(&self) -> Option<OneofDescriptor>

Returns the real (non-synthetic) oneof containing this field, if any.

Source

fn is_optional(&self) -> bool

Returns true if this field is proto3 optional (synthetic oneof).

Implementations on Foreign Types§

Source§

impl FieldConstraintsExt for FieldDescriptor

Implementors§