#[non_exhaustive]pub struct Options {
pub macro_name: Option<Ident>,
pub mock: Option<Path>,
pub repeater: Option<Path>,
pub allow_primitive: bool,
pub allow_std_prelude: bool,
pub krate: Option<Path>,
pub emit_item: bool,
pub layout: Layout,
pub docs: bool,
pub checks: Vec<Check>,
pub metas: Vec<Check>,
/* private fields */
}Expand description
The parsed arguments of #[announce(..)].
Parse it from the attribute’s tokens with syn::parse2; the grammar and
the meaning of every option are those of the #[announce] attribute
(announce::announce). Build one in code with Options::default and
the public fields. Turn it back into attribute arguments with
ToTokens (opts.to_token_stream()), for example to hand it to
announce().
The most useful field for a library is krate: the path to the announce
crate that the generated code uses (see Options::krate()). Without it the
path is read from the Cargo.toml of the crate being compiled, which only
works when that crate depends on announce itself.
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.macro_name: Option<Ident>macro_name = Name: name of the emitted macro. Default: the item’s name. All
the announcements of one item must give the same name, the item’s name where
it is not set: one item has one trampoline.
mock: Option<Path>mock = path: the item is a stand-in for the item at path.
repeater: Option<Path>repeater = path: emit the type-leak table against this repeater trait.
allow_primitive: booltype-leak: primitives resolve everywhere (default true).
allow_std_prelude: booltype-leak: std prelude names resolve everywhere (default false).
krate: Option<Path>crate = path: path to the announce crate in generated code. When it
is None, Options::krate() looks the crate up in Cargo.toml.
emit_item: boolemit_item = false: do not re-emit the item (it is emitted by someone else).
Default true.
layout: Layoutlayout = auto | single | direct: how the trampoline holds the item.
Default auto: by the size of the item (advanced).
docs: booldocs = true: keep the doc attributes (#[doc = ".."], so /// and
//! too) in the item that callbacks and checks receive. Default
false: they are removed there, which makes the trampoline smaller.
The item that is compiled keeps its docs either way.
checks: Vec<Check>Checks: bare path / path(args) entries. They run at the definition.
metas: Vec<Check>meta = path(args): listed in META like a check, but never invoked.
Implementations§
Trait Implementations§
Source§impl ToTokens for Options
impl ToTokens for Options
Source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl !Send for Options
impl !Sync for Options
impl Freeze for Options
impl RefUnwindSafe for Options
impl Unpin for Options
impl UnsafeUnpin for Options
impl UnwindSafe for Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Span covering the complete contents of this syntax tree
node, or Span::call_site() if this node is empty.