Skip to main content

BackendCapabilities

Struct BackendCapabilities 

Source
pub struct BackendCapabilities {
    pub name: &'static str,
    pub vector_text: bool,
    pub embedded_fonts: bool,
    pub gradients: bool,
    pub clipping: bool,
    pub images: bool,
    pub raster_only: bool,
    pub multi_page: bool,
    pub deterministic: bool,
}
Expand description

백엔드가 무엇을 할 수 있는지 스스로 밝힌다 — 소비자가 분기 대신 질의한다.

모든 필드는 그 백엔드의 최종 산출물이 그 성질을 보존하는가를 뜻한다. 중간 단계에서 무엇을 하는지가 아니다. 예를 들어 PDF 는 내부적으로 SVG 를 거치더라도 최종 PDF 가 벡터 텍스트를 담으면 vector_text: true 다.

Fields§

§name: &'static str

백엔드 이름. 진단 메시지와 회귀 기준선 파일명에 쓰는 안정 식별자다.

§vector_text: bool

텍스트를 글리프/문자로 보존하는가(= 산출물에서 텍스트를 다시 선택·검색할 수 있는가).

§embedded_fonts: bool

폰트 바이트를 산출물 안에 실을 수 있는가.

§gradients: bool

그라디언트 채우기를 표현할 수 있는가.

§clipping: bool

클립 영역을 표현할 수 있는가.

§images: bool

래스터 이미지를 실을 수 있는가.

§raster_only: bool

산출물이 픽셀뿐인가(벡터 정보를 잃는가).

raster_only == true 이면 vector_text 는 반드시 false 다. BackendCapabilities::is_consistent 가 이 불변식을 판정한다.

§multi_page: bool

한 번의 finish 로 여러 페이지를 담을 수 있는가.

false 면 소비자는 페이지마다 백엔드를 새로 만들어야 한다.

§deterministic: bool

같은 op 시퀀스를 넣으면 같은 산출물이 나오는가(바이트 동일).

백엔드 간 정합 시험은 이 값이 true 인 백엔드에서만 기준선을 뜰 수 있다.

Implementations§

Source§

impl BackendCapabilities

Source

pub const fn none(name: &'static str) -> Self

아무것도 못 하는 기준선. 계측용 백엔드가 여기서 출발한다.

Source

pub const fn vector(name: &'static str) -> Self

벡터 출력 백엔드(SVG·PDF)가 흔히 갖는 조합.

Source

pub const fn raster(name: &'static str) -> Self

래스터 출력 백엔드(Skia·Canvas)가 흔히 갖는 조합.

raster_only 가 켜지므로 vector_text 는 자동으로 꺼진다.

Source

pub fn supports(&self, feature: BackendFeature) -> bool

한 가지 능력을 질의한다.

소비자 코드가 필드를 직접 읽는 대신 이 메서드를 쓰면, 나중에 능력이 늘어나도 호출 형태가 바뀌지 않는다.

Source

pub fn is_consistent(&self) -> bool

선언이 자기모순이 아닌가 — 래스터 전용인데 벡터 텍스트를 주장하지는 않는가.

Source

pub fn covers(&self, required: &[BackendFeature]) -> bool

self 가 required 의 모든 능력을 포함하는가.

백엔드를 고를 때 “이 문서를 손실 없이 내보내려면 무엇이 필요한가“를 능력 집합으로 적어두고 후보 백엔드에 물어보는 데 쓴다.

Trait Implementations§

Source§

impl Clone for BackendCapabilities

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BackendCapabilities

Source§

impl Debug for BackendCapabilities

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BackendCapabilities

Source§

impl PartialEq for BackendCapabilities

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BackendCapabilities

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more