Skip to main content

OneofConstraintsExt

Trait OneofConstraintsExt 

Source
pub trait OneofConstraintsExt {
    // Required method
    fn oneof_constraints(&self) -> ConstraintDecodeResult<OneofRules>;

    // Provided method
    fn try_is_required(&self) -> Result<bool, ConstraintDecodeError> { ... }
}
Expand description

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

Required Methods§

Source

fn oneof_constraints(&self) -> ConstraintDecodeResult<OneofRules>

Returns the OneofRules for this oneof, if any.

§Errors

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

Provided Methods§

Source

fn try_is_required(&self) -> Result<bool, ConstraintDecodeError>

Returns true if this oneof requires exactly one field to be set.

§Errors

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

Implementations on Foreign Types§

Source§

impl OneofConstraintsExt for OneofDescriptor

Implementors§