Struct OneofOptions

Source
pub struct OneofOptions {
    pub rename: Option<String>,
    pub rename_all: Option<i32>,
    pub json_omittable: i32,
    pub visibility: Option<i32>,
    pub tagged: Option<Tagged>,
    pub flatten: Option<bool>,
}

Fields§

§rename: Option<String>

Rename this oneof’s name

§rename_all: Option<i32>

Rename all the fields in the oneof.

§json_omittable: i32

Deserialization: This flag dictates how we handle fields which are not provided in the json representation of the message. If this is true, then no error will be returned if the field is not provided. If this is false then not providing a value for this field will result in an error.

Serialization: This flag dictates if we should skip serializing the field in the json representation of the message if the field is equal to the default value for its type.

By default if the value depends on the type of field. If the field is an option then the default value is TRUE_BUT_SERIALIZE which means that the option does not need to be provided but a null value will always be serialized. If the field is not an option then it will be required so FALSE.

§visibility: Option<i32>

This specifies the visibility for oneof fields.

§tagged: Option<Tagged>

If you want to use tagged notation this allows you to configure that.

§flatten: Option<bool>

You can also flatten the oneof directly into the containing message.

Implementations§

Source§

impl OneofOptions

Source

pub fn rename(&self) -> &str

Returns the value of rename, or the default value if rename is unset.

Source

pub fn rename_all(&self) -> RenameAll

Returns the enum value of rename_all, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_rename_all(&mut self, value: RenameAll)

Sets rename_all to the provided enum value.

Source

pub fn flatten(&self) -> bool

Returns the value of flatten, or the default value if flatten is unset.

Source

pub fn json_omittable(&self) -> JsonOmittable

Returns the enum value of json_omittable, or the default if the field is set to an invalid enum value.

Source

pub fn set_json_omittable(&mut self, value: JsonOmittable)

Sets json_omittable to the provided enum value.

Source

pub fn visibility(&self) -> Visibility

Returns the enum value of visibility, or the default if the field is unset or set to an invalid enum value.

Source

pub fn set_visibility(&mut self, value: Visibility)

Sets visibility to the provided enum value.

Trait Implementations§

Source§

impl Clone for OneofOptions

Source§

fn clone(&self) -> OneofOptions

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OneofOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OneofOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Message for OneofOptions

Source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
Source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
Source§

fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message to a buffer. Read more
Source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
Source§

fn encode_length_delimited( &self, buf: &mut impl BufMut, ) -> Result<(), EncodeError>
where Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
Source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
Source§

fn decode(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes an instance of the message from a buffer. Read more
Source§

fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>
where Self: Default,

Decodes a length-delimited instance of the message from the buffer.
Source§

fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
Source§

fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>
where Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
Source§

impl PartialEq for OneofOptions

Source§

fn eq(&self, other: &OneofOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for OneofOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.