pub struct JobTable { /* private fields */ }Expand description
Table formatter for displaying job information.
This struct creates formatted tables with job details including status icons, priority indicators, and truncated IDs for readability.
§Examples
use cargo_hammerwork::utils::display::JobTable;
let mut table = JobTable::new();
// Add multiple jobs
table.add_job_row(
"job-id-1", "email", "pending", "normal", 0,
"2024-01-01 10:00:00", "2024-01-01 10:00:00"
);
table.add_job_row(
"job-id-2", "data-processing", "running", "high", 1,
"2024-01-01 09:55:00", "2024-01-01 10:00:00"
);
// The table will display with color-coded status and priorityImplementations§
Source§impl JobTable
impl JobTable
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new job table with predefined headers.
Headers include: ID, Queue, Status, Priority, Attempts, Created At, Scheduled At
Sourcepub fn add_job_row(
&mut self,
id: &str,
queue_name: &str,
status: &str,
priority: &str,
attempts: i32,
created_at: &str,
scheduled_at: &str,
)
pub fn add_job_row( &mut self, id: &str, queue_name: &str, status: &str, priority: &str, attempts: i32, created_at: &str, scheduled_at: &str, )
Add a job row to the table.
The method automatically:
- Truncates job IDs to 8 characters for readability
- Adds status icons and colors (🟡 pending, 🔵 running, 🟢 completed, etc.)
- Adds priority icons (🚨 critical, ⚡ high, 📝 normal, etc.)
§Arguments
id- Job UUIDqueue_name- Name of the queuestatus- Job status (pending, running, completed, failed, dead, retrying)priority- Job priority (critical, high, normal, low, background)attempts- Number of execution attemptscreated_at- Creation timestampscheduled_at- Scheduled execution timestamp
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobTable
impl RefUnwindSafe for JobTable
impl Send for JobTable
impl Sync for JobTable
impl Unpin for JobTable
impl UnsafeUnpin for JobTable
impl UnwindSafe for JobTable
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.