docs.rs failed to build plugin-0.0.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
plugin-0.2.6
Plugin
Type-Safe, Lazily Evaluated, Plugins for Extensible Types
Plugins provide a consistent interface for mixin methods. You can use a plugin anywhere you would use a "mixin" trait and an implementation.
Example Usage
// Define a struct.
;
// Map it onto an `i32` value.
// Define the plugin evaluation function.
// `Extended` is a type that implements `Extensible`.
assert_eq!;
To do the same thing with a trait, one could do:
Although using a raw trait is less code, plugins provide the following advantages:
- Automatic caching of values. Calling a method again is a constant time operation! This is particularly useful in pipeline structures where only the extensible object is passed around.
- A consistent interface, which also allows for neater name clash resolution. Two modules that provide
PluginX
can be differentiated using a module prefix.
e.get::<mod1::PluginX>();
e.get::<mod2::PluginX>();