Struct LuaFieldDescriptor

Source
pub struct LuaFieldDescriptor(pub FieldDescriptor);

Tuple Fields§

§0: FieldDescriptor

Methods from Deref<Target = FieldDescriptor>§

Source

pub fn proto(&self) -> &FieldDescriptorProto

Get .proto description of field

Source

pub fn name(&self) -> &str

Field name as specified in .proto file.

Source

pub fn number(&self) -> i32

Field number as specified in .proto file.

Source

pub fn full_name(&self) -> String

Fully qualified name of the field: fully qualified name of the declaring type followed by the field name.

Declaring type is a message (for regular field or extensions) or a package (for top-level extensions).

Source

pub fn containing_oneof_including_synthetic(&self) -> Option<OneofDescriptor>

Oneof descriptor containing this field. Do not skip synthetic oneofs.

Source

pub fn containing_oneof(&self) -> Option<OneofDescriptor>

Oneof containing this field.

Return None if this field is not part of oneof or if it is synthetic oneof.

Source

pub fn containing_message(&self) -> MessageDescriptor

Message which contains this field.

For extension fields, this is the message being extended.

Source

pub fn json_name(&self) -> &str

JSON field name.

Can be different from .proto field name.

See JSON mapping for details.

Source

pub fn is_singular(&self) -> bool

If this field is optional or required.

Source

pub fn is_required(&self) -> bool

Is this field required.

Source

pub fn is_repeated_or_map(&self) -> bool

If this field repeated or map?

Source

pub fn is_repeated(&self) -> bool

Is this field repeated, but not map field?

Source

pub fn is_map(&self) -> bool

If this field a map field?

Source

pub fn has_field(&self, m: &(dyn MessageDyn + 'static)) -> bool

Check if field is set in given message.

For repeated field or map field return true if collection is not empty.

§Panics

If this field belongs to a different message type.

Source

pub fn get_message<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> MessageRef<'a>

Get message field or default instance if field is unset.

§Panics

If this field belongs to a different message type or field type is not message.

Source

pub fn mut_message<'a>( &self, m: &'a mut (dyn MessageDyn + 'static), ) -> &'a mut (dyn MessageDyn + 'static)

Get a mutable reference to a message field. Initialize field with default message if unset.

§Panics

If this field belongs to a different message type or field type is not singular message.

Source

pub fn singular_default_value(&self) -> ReflectValueRef<'_>

Default value.

§Panics

If field is not singular.

Source

pub fn get_singular_field_or_default<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> ReflectValueRef<'a>

Get singular field value.

Return field default value if field is unset.

§Panics

If this field belongs to a different message type or fields is not singular.

Source

pub fn singular_runtime_type(&self) -> RuntimeType

Runtime representation of singular field.

§Panics

If this field belongs to a different message type or field is not singular.

Source

pub fn set_singular_field( &self, m: &mut (dyn MessageDyn + 'static), value: ReflectValueBox, )

Set singular field.

§Panics

If this field belongs to a different message type or field is not singular or value is of different type.

Source

pub fn clear_field(&self, m: &mut (dyn MessageDyn + 'static))

Clear a field.

Source

pub fn runtime_field_type(&self) -> RuntimeFieldType

Dynamic representation of field type.

Source

pub fn get_reflect<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> ReflectFieldRef<'a>

Get field of any type.

§Panics

If this field belongs to a different message type.

Source

pub fn get_singular<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> Option<ReflectValueRef<'a>>

Get singular field value.

Return None if field is unset.

§Panics

If this field belongs to a different message type or fields is not singular.

Source

pub fn get_repeated<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> ReflectRepeatedRef<'a>

Get repeated field.

§Panics

If this field belongs to a different message type or field is not repeated.

Source

pub fn mut_repeated<'a>( &self, m: &'a mut (dyn MessageDyn + 'static), ) -> ReflectRepeatedMut<'a>

Get a mutable reference to repeated field.

§Panics

If this field belongs to a different message type or field is not repeated.

Source

pub fn get_map<'a>( &self, m: &'a (dyn MessageDyn + 'static), ) -> ReflectMapRef<'a>

Get map field.

§Panics

If this field belongs to a different message type or field is not map.

Source

pub fn mut_map<'a>( &self, m: &'a mut (dyn MessageDyn + 'static), ) -> ReflectMapMut<'a>

Get a mutable reference to map field.

§Panics

If this field belongs to a different message type or field is not map.

Trait Implementations§

Source§

impl Clone for LuaFieldDescriptor

Source§

fn clone(&self) -> LuaFieldDescriptor

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 Deref for LuaFieldDescriptor

Source§

type Target = FieldDescriptor

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<FieldDescriptor> for LuaFieldDescriptor

Source§

fn from(value: FieldDescriptor) -> Self

Converts to this type from the input type.
Source§

impl From<LuaFieldDescriptor> for FieldDescriptor

Source§

fn from(value: LuaFieldDescriptor) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for LuaFieldDescriptor

Source§

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

Source§

fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)

Adds custom methods and operators specific to this userdata.
Source§

fn add_fields<F>(fields: &mut F)
where F: UserDataFields<Self>,

Adds custom fields specific to this userdata.
Source§

fn register(registry: &mut UserDataRegistry<Self>)

Registers this type for use in Lua. Read more
Source§

impl Eq for LuaFieldDescriptor

Source§

impl StructuralPartialEq for LuaFieldDescriptor

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoLua for T
where T: UserData + MaybeSend + 'static,

Source§

fn into_lua(self, lua: &Lua) -> Result<Value, Error>

Performs the conversion.
Source§

impl<T> IntoLuaMulti for T
where T: IntoLua,

Source§

fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>

Performs the conversion.
Source§

unsafe fn push_into_stack_multi(self, lua: &RawLua) -> Result<i32, Error>

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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> MaybeSend for T