mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
draft Titan response send action
This commit is contained in:
parent
b4074e46c3
commit
89469c2aa3
@ -1,6 +1,23 @@
|
||||
use gtk::gio::{Cancellable, IOStream};
|
||||
use gtk::{
|
||||
gio::{Cancellable, IOStream},
|
||||
glib::{Bytes, Error, Priority},
|
||||
prelude::{IOStreamExt, OutputStreamExt},
|
||||
};
|
||||
|
||||
pub struct Titan {
|
||||
cancellable: Cancellable,
|
||||
stream: IOStream,
|
||||
}
|
||||
|
||||
impl Titan {
|
||||
// Actions
|
||||
|
||||
pub fn send(&self, data: Bytes, callback: impl FnOnce(Result<isize, Error>) + 'static) {
|
||||
self.stream.output_stream().write_bytes_async(
|
||||
&data,
|
||||
Priority::DEFAULT,
|
||||
Some(&self.cancellable),
|
||||
callback,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user