Struct hypothesis::annotations::InputAnnotation[][src]

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>,
}

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: String

URI 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: String

Annotation text / comment given by user

This is NOT the selected text on the web-page

tags: Option<Vec<String>>

Tags attached to the annotation

document: Option<Document>

Further metadata about the target document

group: String

The 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: Target

Which 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

impl InputAnnotation[src]

Trait Implementations

impl Clone for InputAnnotation[src]

impl Debug for InputAnnotation[src]

impl Default for InputAnnotation[src]

impl PartialEq<InputAnnotation> for InputAnnotation[src]

impl Serialize for InputAnnotation[src]

impl StructOpt for InputAnnotation[src]

impl StructOptInternal for InputAnnotation[src]

impl StructuralPartialEq for InputAnnotation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D> OwoColorize for D

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.