pub struct WidgetSession {
pub widget_id: String,
pub permissions: HashSet<WidgetPermission>,
recent_requests: VecDeque<Instant>,
}Expand description
One widget frame’s identity, granted permissions, and request rate.
Fields§
§widget_id: String§permissions: HashSet<WidgetPermission>§recent_requests: VecDeque<Instant>Times of requests in the last second, for rate limiting.
Implementations§
Source§impl WidgetSession
impl WidgetSession
Sourcepub fn new(
widget_id: String,
permissions: impl IntoIterator<Item = WidgetPermission>,
) -> Self
pub fn new( widget_id: String, permissions: impl IntoIterator<Item = WidgetPermission>, ) -> Self
Starts a session with the widget’s granted permissions.
Parses a message and checks its size, rate, protocol version, request ID, and the permission its method requires.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WidgetSession
impl RefUnwindSafe for WidgetSession
impl Send for WidgetSession
impl Sync for WidgetSession
impl Unpin for WidgetSession
impl UnsafeUnpin for WidgetSession
impl UnwindSafe for WidgetSession
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