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
impl BackendCapabilities
Sourcepub const fn raster(name: &'static str) -> Self
pub const fn raster(name: &'static str) -> Self
래스터 출력 백엔드(Skia·Canvas)가 흔히 갖는 조합.
raster_only 가 켜지므로 vector_text 는 자동으로 꺼진다.
Sourcepub fn supports(&self, feature: BackendFeature) -> bool
pub fn supports(&self, feature: BackendFeature) -> bool
한 가지 능력을 질의한다.
소비자 코드가 필드를 직접 읽는 대신 이 메서드를 쓰면, 나중에 능력이 늘어나도 호출 형태가 바뀌지 않는다.
Sourcepub fn is_consistent(&self) -> bool
pub fn is_consistent(&self) -> bool
선언이 자기모순이 아닌가 — 래스터 전용인데 벡터 텍스트를 주장하지는 않는가.
Sourcepub fn covers(&self, required: &[BackendFeature]) -> bool
pub fn covers(&self, required: &[BackendFeature]) -> bool
self 가 required 의 모든 능력을 포함하는가.
백엔드를 고를 때 “이 문서를 손실 없이 내보내려면 무엇이 필요한가“를 능력 집합으로 적어두고 후보 백엔드에 물어보는 데 쓴다.
Trait Implementations§
Source§impl Clone for BackendCapabilities
impl Clone for BackendCapabilities
impl Copy for BackendCapabilities
Source§impl Debug for BackendCapabilities
impl Debug for BackendCapabilities
impl Eq for BackendCapabilities
Source§impl PartialEq for BackendCapabilities
impl PartialEq for BackendCapabilities
impl StructuralPartialEq for BackendCapabilities
Auto Trait Implementations§
impl Forget for BackendCapabilities
impl Freeze for BackendCapabilities
impl Move for BackendCapabilities
impl RefUnwindSafe for BackendCapabilities
impl Send for BackendCapabilities
impl Sync for BackendCapabilities
impl Unpin for BackendCapabilities
impl UnsafeUnpin for BackendCapabilities
impl UnwindSafe for BackendCapabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.