draft meta parser

This commit is contained in:
yggverse 2024-09-25 21:14:23 +03:00
parent 1a644ee219
commit 4cdfaa2d6b

View file

@ -10,11 +10,12 @@ use gtk::{
prelude::{BoxExt, IOStreamExt, InputStreamExtManual, OutputStreamExtManual, SocketClientExt}, prelude::{BoxExt, IOStreamExt, InputStreamExtManual, OutputStreamExtManual, SocketClientExt},
Box, Orientation, Box, Orientation,
}; };
use std::sync::Arc;
pub struct Page { pub struct Page {
widget: Box, widget: Box,
navigation: Navigation, navigation: Navigation,
content: Content, content: Arc<Content>,
} }
impl Page { impl Page {
@ -76,15 +77,26 @@ impl Page {
vec![0; 0xfffff], // 1Mb @TODO vec![0; 0xfffff], // 1Mb @TODO
Priority::DEFAULT, Priority::DEFAULT,
Some(&Cancellable::new()), Some(&Cancellable::new()),
{
move |result| match result { move |result| match result {
Ok(response) => { Ok(response) => {
println!( match GString::from_utf8_until_nul(
"Result: {:?}", response.0,
GString::from_utf8_until_nul( ) {
response.0 Ok(data) => {
) // Detect page meta
); // @TODO let meta = Regex::split_simple(
r"^(\d+)?\s([\w]+\/[\w]+)?",
data,
RegexCompileFlags::DEFAULT,
RegexMatchFlags::DEFAULT,
);
//println!("{:?}", meta);
//println!("Result: {}", data);
}
Err(_) => todo!(),
}
// @TODO connection.close(cancellable); // @TODO connection.close(cancellable);
} }
Err(e) => { Err(e) => {
@ -93,7 +105,6 @@ impl Page {
e e
); );
} }
}
}, },
); );
} }