pub struct WebDashboard { /* private fields */ }Expand description
Main web dashboard server.
The WebDashboard provides a complete web interface for monitoring and managing
Hammerwork job queues. It includes REST API endpoints, WebSocket support for
real-time updates, authentication, and a modern HTML/CSS/JS frontend.
§Examples
use hammerwork_web::{WebDashboard, DashboardConfig};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = DashboardConfig::new()
.with_bind_address("127.0.0.1", 8080)
.with_database_url("postgresql://localhost/hammerwork")
.with_static_dir(PathBuf::from("./assets"))
.with_cors(false);
let dashboard = WebDashboard::new(config).await?;
dashboard.start().await?;
Ok(())
}Implementations§
Source§impl WebDashboard
impl WebDashboard
Sourcepub async fn new(config: DashboardConfig) -> Result<Self>
pub async fn new(config: DashboardConfig) -> Result<Self>
Create a new web dashboard instance.
This initializes the dashboard with the provided configuration but does not
start the web server. Call start() to begin serving requests.
§Examples
use hammerwork_web::{WebDashboard, DashboardConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = DashboardConfig::new()
.with_database_url("postgresql://localhost/hammerwork");
let dashboard = WebDashboard::new(config).await?;
// Dashboard is created but not yet started
Ok(())
}§Errors
Returns an error if the configuration is invalid or if initialization fails.
Auto Trait Implementations§
impl Freeze for WebDashboard
impl !RefUnwindSafe for WebDashboard
impl Send for WebDashboard
impl Sync for WebDashboard
impl Unpin for WebDashboard
impl !UnwindSafe for WebDashboard
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