pub struct AdminRouter { /* private fields */ }Expand description
Admin router builder (for backward compatibility)
This struct is kept for backward compatibility with existing code.
New code should use admin_routes() function directly.
Implementations§
Source§impl AdminRouter
impl AdminRouter
Sourcepub fn from_arc(site: Arc<AdminSite>) -> Self
pub fn from_arc(site: Arc<AdminSite>) -> Self
Create a new admin router builder from Arc-wrapped site
Sourcepub fn with_favicon_file(self, path: impl AsRef<Path>) -> Self
pub fn with_favicon_file(self, path: impl AsRef<Path>) -> Self
Sourcepub fn with_favicon_bytes(self, data: Vec<u8>) -> Self
pub fn with_favicon_bytes(self, data: Vec<u8>) -> Self
Set favicon from raw bytes
§Examples
ⓘ
// Cannot run: favicon.ico file does not exist
use reinhardt_admin::core::{AdminSite, AdminRouter};
use std::sync::Arc;
let favicon_bytes = include_bytes!("favicon.ico").to_vec();
let site = Arc::new(AdminSite::new("Admin"));
let router = AdminRouter::from_arc(site)
.with_favicon_bytes(favicon_bytes)
.build();Sourcepub fn routes(&self) -> ServerRouter
pub fn routes(&self) -> ServerRouter
Build the ServerRouter with all admin endpoints
Generated endpoints:
GET /- Dashboard (list of registered models)GET /favicon.ico- FaviconGET /{model}/- List model instancesGET /{model}/{id}/- Get model instance detailPOST /{model}/- Create model instancePUT /{model}/{id}/- Update model instanceDELETE /{model}/{id}/- Delete model instancePOST /{model}/bulk-delete/- Bulk delete model instancesGET /{model}/export/- Export model dataPOST /{model}/import/- Import model data
Sourcepub fn build(self) -> ServerRouter
pub fn build(self) -> ServerRouter
Build the ServerRouter (alias for routes())
Auto Trait Implementations§
impl Freeze for AdminRouter
impl !RefUnwindSafe for AdminRouter
impl Send for AdminRouter
impl Sync for AdminRouter
impl Unpin for AdminRouter
impl !UnwindSafe for AdminRouter
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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