pub struct Registries { /* private fields */ }Expand description
The registries of one app. Cloning gives another handle to the same registries; use
Registries::new for a separate app.
Implementations§
Source§impl Registries
impl Registries
Sourcepub fn register_editor(&self, script_url: impl Into<String>)
pub fn register_editor(&self, script_url: impl Into<String>)
Sets the URL of the script that turns wysiwyg textareas into an editor. The panel loads
it with <script src="..." defer> on each form with a wysiwyg field, from the next
request on. Registering again replaces the URL. With no script registered, a wysiwyg
field is a plain textarea.
Sourcepub fn editor_script(&self) -> Option<String>
pub fn editor_script(&self) -> Option<String>
The URL of the registered editor script, if the app registered one.
Source§impl Registries
impl Registries
Sourcepub fn register_media_library(&self, library: impl MediaLibrary)
pub fn register_media_library(&self, library: impl MediaLibrary)
Sets the media library that media fields use, from the next request on. Registering again replaces it.
Sourcepub fn media_library(&self) -> Option<Arc<dyn MediaLibrary>>
pub fn media_library(&self) -> Option<Arc<dyn MediaLibrary>>
The registered media library, if the app registered one.
Source§impl Registries
impl Registries
Sourcepub fn register_policy(&self, slug: impl Into<String>, policy: impl Policy)
pub fn register_policy(&self, slug: impl Into<String>, policy: impl Policy)
Registers policy for the resource at slug, static or runtime, as Laravel’s
Gate::policy maps a model to its policy. It takes effect from the next request on, and
replaces the policy the slug had. The slug need not be registered yet: a policy is kept
when its runtime resource is removed and registered again.
Sourcepub fn unregister_policy(&self, slug: &str) -> bool
pub fn unregister_policy(&self, slug: &str) -> bool
Removes the policy of the resource at slug, so its abilities alone decide again.
Returns whether it had one.
Source§impl Registries
impl Registries
Sourcepub fn default_app() -> Self
pub fn default_app() -> Self
The default app’s registries: the process-wide set that the free functions of
ignite_core (such as register_runtime) act on, and that a
panel built with Ignite::new() serves when it takes no handle. Every call returns a
handle to the same registries.
Sourcepub fn same_app(&self, other: &Registries) -> bool
pub fn same_app(&self, other: &Registries) -> bool
Whether other is a handle to the same registries as self.
Source§impl Registries
impl Registries
Sourcepub fn register_runtime(
&self,
resource: RuntimeResource,
) -> Result<(), RuntimeError>
pub fn register_runtime( &self, resource: RuntimeResource, ) -> Result<(), RuntimeError>
Adds a runtime resource to this app. It shows in the navigation and the dashboard, and
its list, forms and delete action answer at /<mount>/<slug>, from the next request on.
Create its permissions (<slug>.viewAny and the others) in the same request with
ignite_panel::register_runtime_permissions; otherwise the panel creates them on the
next signed-in request.
Refuses a slug that is not valid, a slug that a static resource, another runtime resource
of this app or one of the panel’s own pages (such as login) uses, and two fields with
one name. Another app’s resources are not consulted: each app has its own registry.
Source§impl Registries
impl Registries
Sourcepub fn unregister_runtime(&self, slug: &str) -> Result<(), RuntimeError>
pub fn unregister_runtime(&self, slug: &str) -> Result<(), RuntimeError>
Removes the runtime resource at slug. From the next request on, it is gone from the
navigation and its routes answer 404. Its permission rows stay, so the grants come back
if the resource is registered again.
Sourcepub fn runtime_resource(&self, slug: &str) -> Option<Arc<RegisteredResource>>
pub fn runtime_resource(&self, slug: &str) -> Option<Arc<RegisteredResource>>
The runtime resource at slug, if one is registered.
Sourcepub fn runtime_resources(&self) -> Vec<Arc<RegisteredResource>>
pub fn runtime_resources(&self) -> Vec<Arc<RegisteredResource>>
Every runtime resource, in registration order.
Sourcepub fn reserve_slugs(&self, slugs: &[&str]) -> Result<(), RuntimeError>
pub fn reserve_slugs(&self, slugs: &[&str]) -> Result<(), RuntimeError>
Reserves slugs, so no runtime resource can take them. The panel reserves the slugs of
its static resources and of its own pages when it is built. Reserving a slug twice is
fine. Refuses, and reserves none, when a runtime resource already has one of them.
Trait Implementations§
Source§impl Clone for Registries
impl Clone for Registries
Source§impl Debug for Registries
impl Debug for Registries
Auto Trait Implementations§
impl Forget for Registries
impl Freeze for Registries
impl Move for Registries
impl RefUnwindSafe for Registrieswhere
Atomic<usize>: RefUnwindSafe,
RwLock<RuntimeRegistry>: RefUnwindSafe,
RwLock<HashMap<String, Arc<dyn Policy>>>: RefUnwindSafe,
RwLock<Option<String>>: RefUnwindSafe,
RwLock<Option<Arc<dyn MediaLibrary>>>: RefUnwindSafe,
impl Send for Registries
impl Sync for Registries
impl Unpin for Registries
impl UnsafeUnpin for Registries
impl UnwindSafe for Registrieswhere
Arc<Inner>: UnwindSafe,
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more