DescriptorProto

Struct DescriptorProto 

Source
#[non_exhaustive]
pub struct DescriptorProto { pub name: String, pub field: Vec<FieldDescriptorProto>, pub extension: Vec<FieldDescriptorProto>, pub nested_type: Vec<DescriptorProto>, pub enum_type: Vec<EnumDescriptorProto>, pub extension_range: Vec<ExtensionRange>, pub oneof_decl: Vec<OneofDescriptorProto>, pub options: Option<MessageOptions>, pub reserved_range: Vec<ReservedRange>, pub reserved_name: Vec<String>, /* private fields */ }
Expand description

Describes a message type.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String§field: Vec<FieldDescriptorProto>§extension: Vec<FieldDescriptorProto>§nested_type: Vec<DescriptorProto>§enum_type: Vec<EnumDescriptorProto>§extension_range: Vec<ExtensionRange>§oneof_decl: Vec<OneofDescriptorProto>§options: Option<MessageOptions>§reserved_range: Vec<ReservedRange>§reserved_name: Vec<String>

Reserved field names, which may not be used by fields in the same message. A given name may only be reserved once.

Implementations§

Source§

impl DescriptorProto

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = DescriptorProto::new().set_name("example");
Source

pub fn set_field<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<FieldDescriptorProto>,

Sets the value of field.

§Example
use google_cloud_wkt::FieldDescriptorProto;
let x = DescriptorProto::new()
    .set_field([
        FieldDescriptorProto::default()/* use setters */,
        FieldDescriptorProto::default()/* use (different) setters */,
    ]);
Source

pub fn set_extension<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<FieldDescriptorProto>,

Sets the value of extension.

§Example
use google_cloud_wkt::FieldDescriptorProto;
let x = DescriptorProto::new()
    .set_extension([
        FieldDescriptorProto::default()/* use setters */,
        FieldDescriptorProto::default()/* use (different) setters */,
    ]);
Source

pub fn set_nested_type<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<DescriptorProto>,

Sets the value of nested_type.

§Example
let x = DescriptorProto::new()
    .set_nested_type([
        DescriptorProto::default()/* use setters */,
        DescriptorProto::default()/* use (different) setters */,
    ]);
Source

pub fn set_enum_type<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<EnumDescriptorProto>,

Sets the value of enum_type.

§Example
use google_cloud_wkt::EnumDescriptorProto;
let x = DescriptorProto::new()
    .set_enum_type([
        EnumDescriptorProto::default()/* use setters */,
        EnumDescriptorProto::default()/* use (different) setters */,
    ]);
Source

pub fn set_extension_range<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ExtensionRange>,

Sets the value of extension_range.

§Example
use google_cloud_wkt::descriptor_proto::ExtensionRange;
let x = DescriptorProto::new()
    .set_extension_range([
        ExtensionRange::default()/* use setters */,
        ExtensionRange::default()/* use (different) setters */,
    ]);
Source

pub fn set_oneof_decl<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<OneofDescriptorProto>,

Sets the value of oneof_decl.

§Example
use google_cloud_wkt::OneofDescriptorProto;
let x = DescriptorProto::new()
    .set_oneof_decl([
        OneofDescriptorProto::default()/* use setters */,
        OneofDescriptorProto::default()/* use (different) setters */,
    ]);
Source

pub fn set_options<T>(self, v: T) -> Self
where T: Into<MessageOptions>,

Sets the value of options.

§Example
use google_cloud_wkt::MessageOptions;
let x = DescriptorProto::new().set_options(MessageOptions::default()/* use setters */);
Source

pub fn set_or_clear_options<T>(self, v: Option<T>) -> Self
where T: Into<MessageOptions>,

Sets or clears the value of options.

§Example
use google_cloud_wkt::MessageOptions;
let x = DescriptorProto::new().set_or_clear_options(Some(MessageOptions::default()/* use setters */));
let x = DescriptorProto::new().set_or_clear_options(None::<MessageOptions>);
Source

pub fn set_reserved_range<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<ReservedRange>,

Sets the value of reserved_range.

§Example
use google_cloud_wkt::descriptor_proto::ReservedRange;
let x = DescriptorProto::new()
    .set_reserved_range([
        ReservedRange::default()/* use setters */,
        ReservedRange::default()/* use (different) setters */,
    ]);
Source

pub fn set_reserved_name<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of reserved_name.

§Example
let x = DescriptorProto::new().set_reserved_name(["a", "b", "c"]);

Trait Implementations§

Source§

impl Clone for DescriptorProto

Source§

fn clone(&self) -> DescriptorProto

Returns a duplicate 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 DescriptorProto

Source§

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

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

impl Default for DescriptorProto

Source§

fn default() -> DescriptorProto

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

impl Message for DescriptorProto

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for DescriptorProto

Source§

fn eq(&self, other: &DescriptorProto) -> 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 DescriptorProto

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,