pub struct OverviewField { /* private fields */ }Expand description
A single computed field displayed in the Overview section of the Inspector.
The handler receives a SingleEntryContext and returns an optional string
value to display. Return None to hide the field for that entry.
use powhttp_sdk::{OverviewField, ExtensionHandle, SingleEntryContext, Error};
let field = OverviewField::new(
"content-length",
"Content Length",
async |ctx: SingleEntryContext, handle: ExtensionHandle| {
let entry = handle.get_session_entry(ctx.session_id, ctx.entry_id).await?;
let size = entry
.and_then(|entry| entry.response)
.and_then(|res| res.body_size)
.map(|size| size.to_string());
Ok(size)
},
);Implementations§
Trait Implementations§
Source§impl From<OverviewField> for OverviewNode
impl From<OverviewField> for OverviewNode
Source§fn from(field: OverviewField) -> Self
fn from(field: OverviewField) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for OverviewField
impl !UnwindSafe for OverviewField
impl Freeze for OverviewField
impl Send for OverviewField
impl Sync for OverviewField
impl Unpin for OverviewField
impl UnsafeUnpin for OverviewField
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