h2s_core/
lib.rs

1//! A core part of h2s
2
3use html::HtmlElement;
4use std::error::Error;
5use std::fmt::Debug;
6
7use parseable::Parseable;
8
9use crate::functor::Functor;
10
11pub mod display;
12pub mod element_selector;
13pub mod error;
14pub mod extraction_method;
15pub mod field_value;
16pub mod functor;
17pub mod html;
18pub mod macro_utils;
19pub mod parseable;
20pub mod transformable;
21pub mod traversable;
22pub mod traversable_with_context;
23
24/// A converter from single HTML element to single struct
25pub trait FromHtml: Sized {
26    type Error: Error;
27
28    fn from_html<N>(input: N) -> Result<Self, Self::Error>
29    where
30        N: HtmlElement;
31}
32
33#[derive(Debug)]
34pub struct FieldError {
35    pub field_name: String,
36    pub error: Box<dyn Error>,
37}
38
39/// Similar with std::convert::Infallible
40#[derive(Debug, Clone, Eq, PartialEq)]
41pub enum Never {}
42
43// TODO remove?
44#[derive(Debug, Clone, Eq, PartialEq)]
45pub struct Tuple<T, U>(pub T, pub U);