pub struct ReactPlugin { /* private fields */ }Expand description
Installs React islands in an Autumn app.
It serves the loader (REACT_ASSETS) and each app bundle under
/static/_plugins/<namespace>/. It reads no configuration.
use autumn_plugin_react::ReactPlugin;
use autumn_web::assets::PluginAssets;
static ISLANDS: PluginAssets =
PluginAssets::from_files("app-islands", &[("islands.js", b"/* build */")]);
autumn_web::app()
.plugin(ReactPlugin::new().bundle(&ISLANDS))
.run()
.await;The plugin name includes each bundle namespace and a fingerprint of its
files, for example autumn-plugin-react[app-islands@1a2b3c4d]. Thus a
library crate and the app can each install a ReactPlugin with their
own bundles. Autumn skips a second plugin with the same bundles. Two
different bundles with one namespace stop the app at start-up.
Implementations§
Source§impl ReactPlugin
impl ReactPlugin
Sourcepub fn bundle(self, bundle: &'static PluginAssets) -> Self
pub fn bundle(self, bundle: &'static PluginAssets) -> Self
Adds an app bundle of compiled React components.
The plugin uses a bundle one time, also when you add it two times.
§Panics
Panics when the bundle namespace is react. The loader bundle uses
it. Autumn also stops at start-up when two different bundles use one
namespace.
Trait Implementations§
Source§impl Debug for ReactPlugin
impl Debug for ReactPlugin
Source§impl Default for ReactPlugin
impl Default for ReactPlugin
Source§impl Plugin for ReactPlugin
impl Plugin for ReactPlugin
Source§fn name(&self) -> Cow<'static, str>
fn name(&self) -> Cow<'static, str>
Source§fn contract(&self) -> Option<PluginContract>
fn contract(&self) -> Option<PluginContract>
autumn-web versions this plugin supports, and any
experimental surface it knowingly depends on. Read moreSource§fn build(self, app: AppBuilder) -> AppBuilder
fn build(self, app: AppBuilder) -> AppBuilder
Auto Trait Implementations§
impl Forget for ReactPlugin
impl Freeze for ReactPlugin
impl RefUnwindSafe for ReactPlugin
impl Send for ReactPlugin
impl Sync for ReactPlugin
impl Unpin for ReactPlugin
impl UnsafeUnpin for ReactPlugin
impl UnwindSafe for ReactPlugin
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> 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<P> Plugins for Pwhere
P: Plugin,
impl<P> Plugins for Pwhere
P: Plugin,
Source§fn apply(self, app: AppBuilder) -> AppBuilder
fn apply(self, app: AppBuilder) -> AppBuilder
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.