pub trait SpecifiedValueInfo {
const SUPPORTED_TYPES: u8 = 0u8;
// Provided method
fn collect_completion_keywords(_f: KeywordsCollectFn<'_>) { ... }
}
Expand description
Information of values of a given specified value type.
This trait is derivable with #[derive(SpecifiedValueInfo)]
.
The algorithm traverses the type definition. For SUPPORTED_TYPES
,
it puts an or’ed value of SUPPORTED_TYPES
of all types it finds.
For collect_completion_keywords
, it recursively invokes this
method on types found, and lists all keyword values and function
names following the same rule as ToCss
in that method.
Some attributes of ToCss
can affect the behavior, specifically:
- If
#[css(function)]
is found, the content inside the annotated variant (or the whole type) isn’t traversed, only the function name is listed incollect_completion_keywords
. - If
#[css(skip)]
is found, the content inside the variant or field is ignored. - Values listed in
#[css(if_empty)]
,#[parse(aliases)]
, and#[css(keyword)]
are added intocollect_completion_keywords
.
In addition to css
attributes, it also has value_info
helper
attributes, including:
#[value_info(ty = "TYPE")]
can be used to specify a constant fromCssType
toSUPPORTED_TYPES
.#[value_info(other_values = "value1,value2")]
can be used to add other values related to a field, variant, or the type itself intocollect_completion_keywords
.#[value_info(starts_with_keyword)]
can be used on variants to add the name of a non-unit variant (serialized likeToCss
) intocollect_completion_keywords
.
Provided Associated Constants§
sourceconst SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
Supported CssTypes by the given value type.
XXX This should be typed CssType when that becomes a bitflags. Currently we cannot do so since bitflags cannot be used in constant.
Provided Methods§
sourcefn collect_completion_keywords(_f: KeywordsCollectFn<'_>)
fn collect_completion_keywords(_f: KeywordsCollectFn<'_>)
Collect value starting words for the given specified value type. This includes keyword and function names which can appear at the beginning of a value of this type.
Caller should pass in a callback function to accept the list of values. The callback function can be called multiple times, and some values passed to the callback may be duplicate.