#[non_exhaustive]pub struct Rule {
pub condition: Option<Condition>,
pub action: Option<Action>,
/* private fields */
}Expand description
A rule is a condition-action pair
- A condition defines when a rule is to be triggered.
- An action specifies what occurs on that trigger. Currently rules only work for controls with SOLUTION_TYPE_SEARCH.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.condition: Option<Condition>Required. The condition that triggers the rule. If the condition is empty, the rule will always apply.
action: Option<Action>An action must be provided.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn set_condition<T>(self, v: T) -> Self
pub fn set_condition<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_condition<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_condition<T>(self, v: Option<T>) -> Self
Sourcepub fn set_action<T: Into<Option<Action>>>(self, v: T) -> Self
pub fn set_action<T: Into<Option<Action>>>(self, v: T) -> Self
Sourcepub fn boost_action(&self) -> Option<&Box<BoostAction>>
pub fn boost_action(&self) -> Option<&Box<BoostAction>>
The value of action
if it holds a BoostAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_boost_action<T: Into<Box<BoostAction>>>(self, v: T) -> Self
pub fn set_boost_action<T: Into<Box<BoostAction>>>(self, v: T) -> Self
Sets the value of action
to hold a BoostAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::BoostAction;
let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
assert!(x.boost_action().is_some());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn redirect_action(&self) -> Option<&Box<RedirectAction>>
pub fn redirect_action(&self) -> Option<&Box<RedirectAction>>
The value of action
if it holds a RedirectAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_redirect_action<T: Into<Box<RedirectAction>>>(self, v: T) -> Self
pub fn set_redirect_action<T: Into<Box<RedirectAction>>>(self, v: T) -> Self
Sets the value of action
to hold a RedirectAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::RedirectAction;
let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
assert!(x.redirect_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn oneway_synonyms_action(&self) -> Option<&Box<OnewaySynonymsAction>>
pub fn oneway_synonyms_action(&self) -> Option<&Box<OnewaySynonymsAction>>
The value of action
if it holds a OnewaySynonymsAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_oneway_synonyms_action<T: Into<Box<OnewaySynonymsAction>>>(
self,
v: T,
) -> Self
pub fn set_oneway_synonyms_action<T: Into<Box<OnewaySynonymsAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a OnewaySynonymsAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
assert!(x.oneway_synonyms_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn do_not_associate_action(&self) -> Option<&Box<DoNotAssociateAction>>
pub fn do_not_associate_action(&self) -> Option<&Box<DoNotAssociateAction>>
The value of action
if it holds a DoNotAssociateAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_do_not_associate_action<T: Into<Box<DoNotAssociateAction>>>(
self,
v: T,
) -> Self
pub fn set_do_not_associate_action<T: Into<Box<DoNotAssociateAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a DoNotAssociateAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
assert!(x.do_not_associate_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn replacement_action(&self) -> Option<&Box<ReplacementAction>>
pub fn replacement_action(&self) -> Option<&Box<ReplacementAction>>
The value of action
if it holds a ReplacementAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_replacement_action<T: Into<Box<ReplacementAction>>>(
self,
v: T,
) -> Self
pub fn set_replacement_action<T: Into<Box<ReplacementAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a ReplacementAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::ReplacementAction;
let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
assert!(x.replacement_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn ignore_action(&self) -> Option<&Box<IgnoreAction>>
pub fn ignore_action(&self) -> Option<&Box<IgnoreAction>>
The value of action
if it holds a IgnoreAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_ignore_action<T: Into<Box<IgnoreAction>>>(self, v: T) -> Self
pub fn set_ignore_action<T: Into<Box<IgnoreAction>>>(self, v: T) -> Self
Sets the value of action
to hold a IgnoreAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::IgnoreAction;
let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
assert!(x.ignore_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn filter_action(&self) -> Option<&Box<FilterAction>>
pub fn filter_action(&self) -> Option<&Box<FilterAction>>
The value of action
if it holds a FilterAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_filter_action<T: Into<Box<FilterAction>>>(self, v: T) -> Self
pub fn set_filter_action<T: Into<Box<FilterAction>>>(self, v: T) -> Self
Sets the value of action
to hold a FilterAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::FilterAction;
let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
assert!(x.filter_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn twoway_synonyms_action(&self) -> Option<&Box<TwowaySynonymsAction>>
pub fn twoway_synonyms_action(&self) -> Option<&Box<TwowaySynonymsAction>>
The value of action
if it holds a TwowaySynonymsAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_twoway_synonyms_action<T: Into<Box<TwowaySynonymsAction>>>(
self,
v: T,
) -> Self
pub fn set_twoway_synonyms_action<T: Into<Box<TwowaySynonymsAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a TwowaySynonymsAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
assert!(x.twoway_synonyms_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn force_return_facet_action(&self) -> Option<&Box<ForceReturnFacetAction>>
pub fn force_return_facet_action(&self) -> Option<&Box<ForceReturnFacetAction>>
The value of action
if it holds a ForceReturnFacetAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_force_return_facet_action<T: Into<Box<ForceReturnFacetAction>>>(
self,
v: T,
) -> Self
pub fn set_force_return_facet_action<T: Into<Box<ForceReturnFacetAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a ForceReturnFacetAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
assert!(x.force_return_facet_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.remove_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn remove_facet_action(&self) -> Option<&Box<RemoveFacetAction>>
pub fn remove_facet_action(&self) -> Option<&Box<RemoveFacetAction>>
The value of action
if it holds a RemoveFacetAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_remove_facet_action<T: Into<Box<RemoveFacetAction>>>(
self,
v: T,
) -> Self
pub fn set_remove_facet_action<T: Into<Box<RemoveFacetAction>>>( self, v: T, ) -> Self
Sets the value of action
to hold a RemoveFacetAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::RemoveFacetAction;
let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
assert!(x.remove_facet_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.pin_action().is_none());Sourcepub fn pin_action(&self) -> Option<&Box<PinAction>>
pub fn pin_action(&self) -> Option<&Box<PinAction>>
The value of action
if it holds a PinAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_pin_action<T: Into<Box<PinAction>>>(self, v: T) -> Self
pub fn set_pin_action<T: Into<Box<PinAction>>>(self, v: T) -> Self
Sets the value of action
to hold a PinAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_retail_v2::model::rule::PinAction;
let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
assert!(x.pin_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.oneway_synonyms_action().is_none());
assert!(x.do_not_associate_action().is_none());
assert!(x.replacement_action().is_none());
assert!(x.ignore_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.twoway_synonyms_action().is_none());
assert!(x.force_return_facet_action().is_none());
assert!(x.remove_facet_action().is_none());Trait Implementations§
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request