draft Titan response send action

This commit is contained in:
yggverse 2025-01-19 13:49:42 +02:00
parent b4074e46c3
commit 89469c2aa3

View File

@ -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,
)
}
}