From 89469c2aa3952739d8890b97c9082243dec2aa31 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 19 Jan 2025 13:49:42 +0200 Subject: [PATCH] draft Titan response send action --- .../item/page/client/response/input/titan.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/app/browser/window/tab/item/page/client/response/input/titan.rs b/src/app/browser/window/tab/item/page/client/response/input/titan.rs index 809f0975..2d6f583c 100644 --- a/src/app/browser/window/tab/item/page/client/response/input/titan.rs +++ b/src/app/browser/window/tab/item/page/client/response/input/titan.rs @@ -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) + 'static) { + self.stream.output_stream().write_bytes_async( + &data, + Priority::DEFAULT, + Some(&self.cancellable), + callback, + ) + } +}