mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
implement shared cancellable reference
This commit is contained in:
parent
9658e772da
commit
609cdf8512
2 changed files with 24 additions and 7 deletions
|
|
@ -1,11 +1,18 @@
|
|||
/// Single client instance holder for `Page` object.
|
||||
use gtk::gio::Cancellable;
|
||||
use std::cell::RefCell;
|
||||
|
||||
/// Multi-client holder for single `Page` object
|
||||
///
|
||||
/// unlike new client instance init on every page open,
|
||||
/// this solution provide additional client-side features
|
||||
/// e.g. session cache management on certificate change in runtime
|
||||
/// Unlike init new client instance on every page load,
|
||||
/// this struct creates single holder for different protocol drivers;
|
||||
/// it also provides additional client-side features
|
||||
/// e.g. session resumption or multi-thread connection management (depending of client type selected)
|
||||
pub struct Client {
|
||||
// Shared reference to cancel async operations
|
||||
pub cancellable: RefCell<Cancellable>,
|
||||
// Clients
|
||||
pub gemini: gemini::Client,
|
||||
// other supported clients here..
|
||||
// other clients..
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
|
@ -14,6 +21,7 @@ impl Client {
|
|||
/// Create new `Self`
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
cancellable: RefCell::new(Cancellable::new()),
|
||||
gemini: gemini::Client::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue