Trait FromValue

Source
pub trait FromValue<V = Value>: Sized + Reflect {
    // Required method
    fn from_value(value: V) -> HintedStrResult<Self>;
}
Expand description

Try to cast a Typst Value into a Rust type.

See also: Reflect.

Required Methods§

Source

fn from_value(value: V) -> HintedStrResult<Self>

Try to cast the value into an instance of Self.

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.

Implementations on Foreign Types§

Source§

impl FromValue for Month

Source§

impl FromValue for MathClass

Source§

impl FromValue for bool

Source§

impl FromValue for char

Source§

impl FromValue for f64

Source§

impl FromValue for i8

Source§

impl FromValue for i16

Source§

impl FromValue for i32

Source§

impl FromValue for i64

Source§

impl FromValue for isize

Source§

impl FromValue for u8

Source§

impl FromValue for u16

Source§

impl FromValue for u32

Source§

impl FromValue for u64

Source§

impl FromValue for ()

Source§

impl FromValue for usize

Source§

impl FromValue for String

Source§

impl FromValue for NonZeroI64

Source§

impl FromValue for NonZeroIsize

Source§

impl FromValue for NonZeroU64

Source§

impl FromValue for NonZeroUsize

Source§

impl<T: FromValue> FromValue for Option<T>

Source§

impl<T: FromValue> FromValue for Arc<T>

Source§

impl<T: FromValue> FromValue for Vec<T>

Source§

impl<T: FromValue> FromValue<Spanned<Value>> for Spanned<T>

Source§

impl<T: FromValue, const N: usize> FromValue for SmallVec<[T; N]>

Implementors§

Source§

impl FromValue for CounterKey

Source§

impl FromValue for CounterUpdate

Source§

impl FromValue for StateUpdate

Source§

impl FromValue for Alignment

Source§

impl FromValue for Axis

Source§

impl FromValue for Binding

Source§

impl FromValue for BlockBody

Source§

impl FromValue for Dir

Source§

impl FromValue for HAlignment

Source§

impl FromValue for Marginal

Source§

impl FromValue for OuterHAlignment

Source§

impl FromValue for OuterVAlignment

Source§

impl FromValue for Parity

Source§

impl FromValue for PlacementScope

Source§

impl FromValue for ScaleAmount

Source§

impl FromValue for Side

Source§

impl FromValue for Sizing

Source§

impl FromValue for Spacing

Source§

impl FromValue for StackChild

Source§

impl FromValue for VAlignment

Source§

impl FromValue for GridChild

Source§

impl FromValue for GridItem

Source§

impl FromValue for DataSource

Source§

impl FromValue for Encoding

Source§

impl FromValue for Readable

Source§

impl FromValue for RowType

Source§

impl FromValue for CancelAngle

Source§

impl FromValue for MathSize

Source§

impl FromValue for MathVariant

Source§

impl FromValue for Attribution

Source§

impl FromValue for CitationForm

Source§

impl FromValue for CslSource

Source§

impl FromValue for Destination

Source§

impl FromValue for FigureKind

Source§

impl FromValue for FootnoteBody

Source§

impl FromValue for LineNumberingScope

Source§

impl FromValue for Linebreaks

Source§

impl FromValue for LinkTarget

Source§

impl FromValue for ListMarker

Source§

impl FromValue for Numbering

Source§

impl FromValue for OutlineIndent

Source§

impl FromValue for RefForm

Source§

impl FromValue for Supplement

Source§

impl FromValue for TableChild

Source§

impl FromValue for TableItem

Source§

impl FromValue for EmbeddedFileRelationship

Source§

impl FromValue for EvalMode

Source§

impl FromValue for BottomEdge

Source§

impl FromValue for BottomEdgeMetric

Source§

impl FromValue for Case

Source§

impl FromValue for Caseable

Source§

impl FromValue for Covers

Source§

impl FromValue for FontStyle

Source§

impl FromValue for NumberType

Source§

impl FromValue for NumberWidth

Source§

impl FromValue for RawContent

Source§

impl FromValue for TopEdge

Source§

impl FromValue for TopEdgeMetric

Source§

impl FromValue for VerticalFontMetric

Source§

impl FromValue for CloseMode

Source§

impl FromValue for Color

Source§

impl FromValue for ColorSpace

Source§

impl FromValue for CurveComponent

Source§

impl FromValue for DashLength

Source§

impl FromValue for ExchangeFormat

Source§

impl FromValue for FillRule

Source§

impl FromValue for Gradient

Source§

impl FromValue for ImageFit

Source§

impl FromValue for ImageFormat

Source§

impl FromValue for ImageScaling

Source§

impl FromValue for LineCap

Source§

impl FromValue for LineJoin

Source§

impl FromValue for Paint

Source§

impl FromValue for PathVertex

Source§

impl FromValue for PixelEncoding

Source§

impl FromValue for RasterFormat

Source§

impl FromValue for RatioOrAngle

Source§

impl FromValue for RelativeTo

Source§

impl FromValue for VectorFormat

Source§

impl FromValue for AngleLike

Source§

impl FromValue for DecNum

Source§

impl FromValue for Num

Source§

impl FromValue for ArgumentKey

Source§

impl FromValue for Datetime

Source§

impl FromValue for Endianness

Source§

impl FromValue for Never

Source§

impl FromValue for Replacement

Source§

impl FromValue for Selector

Source§

impl FromValue for StrPattern

Source§

impl FromValue for StrSide

Source§

impl FromValue for Target

Source§

impl FromValue for ToDecimal

Source§

impl FromValue for ToStr

Source§

impl FromValue for Transformation

Source§

impl FromValue for Value

Source§

impl FromValue for VersionComponents

Source§

impl FromValue for EcoString

Source§

impl FromValue for HtmlAttr

Source§

impl FromValue for HtmlAttrs

Source§

impl FromValue for HtmlTag

Source§

impl FromValue for Counter

Source§

impl FromValue for CounterState

Source§

impl FromValue for Location

Source§

impl FromValue for State

Source§

impl FromValue for GridCell

Source§

impl FromValue for TrackSizings

Source§

impl FromValue for Angle

Source§

impl FromValue for Axes<Length>

Source§

impl FromValue for Axes<Ratio>

Source§

impl FromValue for Axes<Rel<Length>>

Source§

impl FromValue for Fr

Source§

impl FromValue for Length

Source§

impl FromValue for Margin

Source§

impl FromValue for Paper

Source§

impl FromValue for Position

Source§

impl FromValue for Ratio

Source§

impl FromValue for Rel<Length>

Source§

impl FromValue for VElem

Source§

impl FromValue for typst_library::loading::Delimiter

Source§

impl FromValue for Accent

Source§

impl FromValue for Augment

Source§

impl FromValue for AugmentOffsets

Source§

impl FromValue for typst_library::math::Delimiter

Source§

impl FromValue for DelimiterPair

Source§

impl FromValue for Author

Source§

impl FromValue for CiteElem

Source§

impl FromValue for EnumItem

Source§

impl FromValue for FigureCaption

Source§

impl FromValue for FirstLineIndent

Source§

impl FromValue for FootnoteElem

Source§

impl FromValue for Keywords

Source§

impl FromValue for ListItem

Source§

impl FromValue for NumberingPattern

Source§

impl FromValue for OutlineEntry

Source§

impl FromValue for TableCell

Source§

impl FromValue for TermItem

Source§

impl FromValue for Url

Source§

impl FromValue for Costs

Source§

impl FromValue for FontFamily

Source§

impl FromValue for FontFeatures

Source§

impl FromValue for FontList

Source§

impl FromValue for FontStretch

Source§

impl FromValue for FontWeight

Source§

impl FromValue for Lang

Source§

impl FromValue for Region

Source§

impl FromValue for SmartQuoteDict

Source§

impl FromValue for SmartQuoteSet

Source§

impl FromValue for StylisticSets

Source§

impl FromValue for TextDir

Source§

impl FromValue for TextSize

Source§

impl FromValue for WritingScript

Source§

impl FromValue for ChromaComponent

Source§

impl FromValue for Component

Source§

impl FromValue for DashPattern

Source§

impl FromValue for GradientStop

Source§

impl FromValue for PixelFormat

Source§

impl FromValue for RatioComponent

Source§

impl FromValue for Stroke

Source§

impl FromValue for Tiling

Source§

impl FromValue for WeightedColor

Source§

impl FromValue for ToAbs

Source§

impl FromValue for Args

Source§

impl FromValue for Array

Source§

impl FromValue for AutoValue

Source§

impl FromValue for Bytes

Source§

impl FromValue for Content

Source§

impl FromValue for Decimal

Source§

impl FromValue for Dict

Source§

impl FromValue for DisplayPattern

Source§

impl FromValue for Duration

Source§

impl FromValue for Element

Source§

impl FromValue for Func

Source§

impl FromValue for Label

Source§

impl FromValue for LocatableSelector

Source§

impl FromValue for Module

Source§

impl FromValue for NoneValue

Source§

impl FromValue for PluginFunc

Source§

impl FromValue for Regex

Source§

impl FromValue for ShowableSelector

Source§

impl FromValue for Str

Source§

impl FromValue for Styles

Source§

impl FromValue for Symbol

Source§

impl FromValue for SymbolVariant

Source§

impl FromValue for ToArray

Source§

impl FromValue for ToBytes

Source§

impl FromValue for ToDict

Source§

impl FromValue for ToFloat

Source§

impl FromValue for ToInt

Source§

impl FromValue for Type

Source§

impl FromValue for Version

Source§

impl<H, V> FromValue for SpecificAlignment<H, V>
where H: Reflect + TryFrom<Alignment, Error = EcoString>, V: Reflect + TryFrom<Alignment, Error = EcoString>,

Source§

impl<T> FromValue for Corners<Option<T>>
where T: FromValue + Clone,

Source§

impl<T> FromValue for Sides<Option<T>>
where T: Default + FromValue + Clone,

Source§

impl<T: FromValue> FromValue for Celled<T>

Source§

impl<T: FromValue> FromValue for Smart<T>

Source§

impl<T: FromValue> FromValue for OneOrMultiple<T>

Source§

impl<T: FromValue> FromValue<Spanned<Value>> for T

Source§

impl<T: NativeElement + FromValue> FromValue for Packed<T>