Skip to main content

DescriptorDataConfig

Struct DescriptorDataConfig 

Source
pub struct DescriptorDataConfig { /* private fields */ }
Expand description

Configures a DescriptorData instance to gather information from a protobuf descriptor, which can be useful to apply attributes programmatically to the target items.

You can then collect the data while also setting up the validators with the set_up_validators method.

Should you wish to not collect any data at all, you can call the omonimous function set_up_validators exported to the root, which will set up the validators and return an empty DescriptorData instance.

Implementations§

Source§

impl DescriptorDataConfig

Source

pub fn set_up_validators( &self, config: &mut Config, files: &[impl AsRef<Path>], include_paths: &[impl AsRef<Path>], packages: &[&str], ) -> Result<DescriptorData, Box<dyn Error>>

Sets up the validators for the specified packages, while also collecting the data that was requested in the configuration. Refer to the omonimous set_up_validators function’s documentation to learn more about the implementations provided by this method.

Source

pub fn new() -> Self

Creates a new instance.

Source

pub const fn collect_all_data() -> Self

Collects data for all items: oneofs, enums and messages.

Source

pub const fn collect_oneofs_data(self) -> Self

Toggles collection of data for oneofs.

Source

pub const fn collect_enums_data(self) -> Self

Toggles collection of data for enums.

Source

pub const fn collect_messages_data(self) -> Self

Toggles collection of data for messages.

Trait Implementations§

Source§

impl Default for DescriptorDataConfig

Source§

fn default() -> DescriptorDataConfig

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

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> 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, 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.