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§
Sourcefn oneof_constraints(&self) -> ConstraintDecodeResult<OneofRules>
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§
Sourcefn try_is_required(&self) -> Result<bool, ConstraintDecodeError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".