pub struct InputAnnotation {
pub uri: String,
pub text: String,
pub tags: Option<Vec<String>>,
pub document: Option<Document>,
pub group: String,
pub target: Target,
pub references: Vec<String>,
}Expand description
Struct to create annotations
All fields except uri are optional, i.e. leave as default.
§Example
use hypothesis::annotations::{InputAnnotation, Target, Selector};
// A simple annotation
let annotation_simple = InputAnnotation::builder()
.uri("https://www.example.com")
.text("My new annotation").build()?;
// A complex annotation
let annotation_complex = InputAnnotation::builder()
.uri("https://www.example.com")
.text("this is a comment")
.target(Target::builder().source("https://www.example.com")
.selector(vec![Selector::new_quote("exact text in website to highlight",
"prefix of text",
"suffix of text")]).build()?)
.tags(vec!["tag1".into(), "tag2".into()])
.build()?;Fields§
§uri: StringURI that this annotation is attached to.
Can be a URL (a web page address) or a URN representing another kind of resource such as DOI (Digital Object Identifier) or a PDF fingerprint.
text: StringAnnotation text / comment given by user
This is NOT the selected text on the web-page
Tags attached to the annotation
document: Option<Document>Further metadata about the target document
group: StringThe unique identifier for the annotation’s group.
If an annotation is a reply to another
annotation (see references), this field will be ignored —
replies belong to the same group as their parent annotations.
target: TargetWhich part of the document does the annotation target?
If left as default then the annotation is linked to the whole page.
references: Vec<String>Annotation IDs for any annotations this annotation references (e.g. is a reply to)
Implementations§
Source§impl InputAnnotation
impl InputAnnotation
pub fn builder() -> InputAnnotationBuilder
Trait Implementations§
Source§impl Clone for InputAnnotation
impl Clone for InputAnnotation
Source§fn clone(&self) -> InputAnnotation
fn clone(&self) -> InputAnnotation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more