pub trait Extractable: Sized {
// Required method
fn extract_from(
node: &NodeHandle,
) -> impl Future<Output = Result<Self, ExtractionError>> + Send;
}Expand description
Types that can be extracted from a live DOM crate::page::NodeHandle.
Implement this manually or derive it with #[derive(Extract)].
§Example
ⓘ
use stygian_browser::extract::{Extractable, ExtractionError, Extract};
use stygian_browser::page::NodeHandle;
#[derive(Extract)]
struct Title {
text: String,
}
// `PageHandle::extract_all::<Title>`.Required Methods§
Sourcefn extract_from(
node: &NodeHandle,
) -> impl Future<Output = Result<Self, ExtractionError>> + Send
fn extract_from( node: &NodeHandle, ) -> impl Future<Output = Result<Self, ExtractionError>> + Send
Extract an instance of Self from the given DOM node.
§Errors
Returns an error when a required selector matches no element, when a CDP call fails, or when nested extraction fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.