Config

Struct Config 

Source
pub struct Config {
    pub ignore_unknown_fields: bool,
    pub allowed_proto_any_urls: Vec<Pattern>,
    pub diagnostic_level_overrides: HashMap<Classification, (Level, Level)>,
    pub uri_overrides: Vec<(Pattern, Option<String>)>,
    pub uri_resolver: Option<UriResolver>,
    pub max_uri_resolution_depth: Option<usize>,
}
Expand description

Configuration structure.

Fields§

§ignore_unknown_fields: bool

When set, do not generate warnings for unknown protobuf fields that are set to their protobuf-defined default value.

§allowed_proto_any_urls: Vec<Pattern>

Protobuf message URLs that are explicitly allowed for use in “any” messages, i.e. that the caller warrants the existence of in the consumer that the plan is validated for.

§diagnostic_level_overrides: HashMap<Classification, (Level, Level)>

Allows the level of diagnostic messages to be overridden based on their classification/code. The logic for this is as follows:

  • if an entry exists for the classication of the incoming diagnostic, override its error level to at most the second argument, and then to at least the first argument. Otherwise,
  • if an entry exists for the group of said classification, use its level limits instead. Otherwise,
  • if an entry exists for Unclassified (code 0), use its level limits instead. Otherwise, do not adjust the level.

Note that setting an entry to (Info, Error) leaves the diagnostic level unchanged.

§uri_overrides: Vec<(Pattern, Option<String>)>

Allows URIs from the plan to be remapped (Some(mapping)) or ignored (None). All resolution can effectively be disabled by just adding a rule that maps * to None. Furthermore, in the absence of a custom yaml_uri_resolver function, this can be used to remap URIs to pre-downloaded files.

§uri_resolver: Option<UriResolver>

Optional callback function for resolving URIs. If specified, all URIs (after processing yaml_uri_overrides) are resolved using this function. The function takes the URI as its argument, and should either return the download contents as a Vec<u8> or return a String-based error. If no downloader is specified, only file:// URLs with an absolute path are supported.

§max_uri_resolution_depth: Option<usize>

Optional URI resolution depth. If specified, dependencies are only resolved this many levels deep. Setting this to zero effectively disables extension URI resolution altogether.

Implementations§

Source§

impl Config

Source

pub fn new() -> Self

Creates a default configuration.

Source

pub fn ignore_unknown_fields(&mut self)

Instructs the validator to ignore protobuf fields that it doesn’t know about yet (i.e., that have been added to the Substrait protobuf descriptions, but haven’t yet been implemented in the validator) if the fields are set to their default value. If this option isn’t set, or if an unknown field is not set to its default value, a warning is emitted.

Source

pub fn allow_proto_any_url(&mut self, pattern: Pattern)

Explicitly allows a protobuf message type to be used in advanced extensions, despite the fact that the validator can’t validate it. If an advanced extension is encountered that isn’t explicitly allowed, a warning is emitted.

Source

pub fn override_diagnostic_level( &mut self, class: Classification, minimum: Level, maximum: Level, )

Sets a minimum and/or maximum error level for the given class of diagnostic messages. Any previous settings for this class are overridden.

Source

pub fn override_uri<S: Into<String>>( &mut self, pattern: Pattern, resolve_as: Option<S>, )

Overrides the resolution behavior for (YAML) URIs matching the given pattern. If resolve_as is None, the URI file will not be resolved; if it is Some(s), it will be resolved as if the URI in the plan had been s.

Source

pub fn add_uri_resolver<F, D, E>(&mut self, resolver: F)
where F: Fn(&str) -> Result<D, E> + Send + 'static, D: AsRef<[u8]> + 'static, E: Error + 'static,

Registers a URI resolution function with this configuration. If the given function fails, any previously registered function will be used as a fallback.

Source

pub fn set_max_uri_resolution_depth(&mut self, depth: Option<usize>)

Sets the maximum recursion depth for URI resolution, in the presence of transitive dependencies. Setting this to None disables the limit, setting this to zero disables URI resolution entirely.

Trait Implementations§

Source§

impl Default for Config

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl !Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

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> AnyExt for T
where T: Any + ?Sized,

Source§

fn downcast_ref<T>(this: &Self) -> Option<&T>
where T: Any,

Attempts to downcast this to T behind reference
Source§

fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>
where T: Any,

Attempts to downcast this to T behind mutable reference
Source§

fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>
where T: Any,

Attempts to downcast this to T behind Rc pointer
Source§

fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>
where T: Any,

Attempts to downcast this to T behind Arc pointer
Source§

fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>
where T: Any,

Attempts to downcast this to T behind Box pointer
Source§

fn downcast_move<T>(this: Self) -> Option<T>
where T: Any, Self: Sized,

Attempts to downcast owned Self to T, useful only in generic context as a workaround for specialization
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, X> CoerceTo<T> for X
where T: CoerceFrom<X> + ?Sized,

Source§

fn coerce_rc_to(self: Rc<X>) -> Rc<T>

Source§

fn coerce_box_to(self: Box<X>) -> Box<T>

Source§

fn coerce_ref_to(&self) -> &T

Source§

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

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

impl<T> ErasedDestructor for T
where T: 'static,