1- use crate :: chunk:: WriteSettings ;
21use std:: convert:: TryFrom ;
32use std:: marker:: PhantomData ;
43use std:: mem:: ManuallyDrop ;
54use std:: num:: NonZeroI32 ;
65
76use super :: * ;
7+ use crate :: chunk:: WriteSettings ;
88
99/// A primitive PDF object.
1010pub trait Primitive {
1111 /// Whether the primitive object starts with one of the PDF delimiter characters.
12- const HAS_DELIMITER : bool ;
12+ const STARTS_WITH_DELIMITER : bool ;
1313
1414 /// Write the object into a buffer.
1515 fn write ( self , buf : & mut Buf ) ;
@@ -19,7 +19,7 @@ impl<T: Primitive> Primitive for &T
1919where
2020 T : Copy ,
2121{
22- const HAS_DELIMITER : bool = T :: HAS_DELIMITER ;
22+ const STARTS_WITH_DELIMITER : bool = T :: STARTS_WITH_DELIMITER ;
2323
2424 #[ inline]
2525 fn write ( self , buf : & mut Buf ) {
2828}
2929
3030impl Primitive for bool {
31- const HAS_DELIMITER : bool = false ;
31+ const STARTS_WITH_DELIMITER : bool = false ;
3232
3333 #[ inline]
3434 fn write ( self , buf : & mut Buf ) {
@@ -41,7 +41,7 @@ impl Primitive for bool {
4141}
4242
4343impl Primitive for i32 {
44- const HAS_DELIMITER : bool = false ;
44+ const STARTS_WITH_DELIMITER : bool = false ;
4545
4646 #[ inline]
4747 fn write ( self , buf : & mut Buf ) {
@@ -50,7 +50,7 @@ impl Primitive for i32 {
5050}
5151
5252impl Primitive for f32 {
53- const HAS_DELIMITER : bool = false ;
53+ const STARTS_WITH_DELIMITER : bool = false ;
5454
5555 #[ inline]
5656 fn write ( self , buf : & mut Buf ) {
@@ -81,7 +81,7 @@ impl Str<'_> {
8181}
8282
8383impl Primitive for Str < ' _ > {
84- const HAS_DELIMITER : bool = true ;
84+ const STARTS_WITH_DELIMITER : bool = true ;
8585
8686 fn write ( self , buf : & mut Buf ) {
8787 buf. limits . register_str_len ( self . 0 . len ( ) ) ;
@@ -147,7 +147,7 @@ impl Primitive for Str<'_> {
147147pub struct TextStr < ' a > ( pub & ' a str ) ;
148148
149149impl Primitive for TextStr < ' _ > {
150- const HAS_DELIMITER : bool = true ;
150+ const STARTS_WITH_DELIMITER : bool = true ;
151151
152152 fn write ( self , buf : & mut Buf ) {
153153 buf. limits . register_str_len ( self . 0 . len ( ) ) ;
@@ -234,7 +234,7 @@ impl LanguageIdentifier {
234234pub struct TextStrWithLang < ' a , ' b > ( pub & ' b [ ( LanguageIdentifier , & ' a str ) ] ) ;
235235
236236impl < ' a , ' b > Primitive for TextStrWithLang < ' a , ' b > {
237- const HAS_DELIMITER : bool = true ;
237+ const STARTS_WITH_DELIMITER : bool = true ;
238238
239239 fn write ( self , buf : & mut Buf ) {
240240 let mut len = 0 ;
@@ -312,7 +312,7 @@ impl<'a, 'b> TextStrLike for TextStrWithLang<'a, 'b> {}
312312pub struct Name < ' a > ( pub & ' a [ u8 ] ) ;
313313
314314impl Primitive for Name < ' _ > {
315- const HAS_DELIMITER : bool = true ;
315+ const STARTS_WITH_DELIMITER : bool = true ;
316316
317317 fn write ( self , buf : & mut Buf ) {
318318 buf. limits . register_name_len ( self . 0 . len ( ) ) ;
@@ -366,7 +366,7 @@ pub(crate) fn is_delimiter_character(byte: u8) -> bool {
366366pub struct Null ;
367367
368368impl Primitive for Null {
369- const HAS_DELIMITER : bool = false ;
369+ const STARTS_WITH_DELIMITER : bool = false ;
370370
371371 #[ inline]
372372 fn write ( self , buf : & mut Buf ) {
@@ -417,7 +417,7 @@ impl Ref {
417417}
418418
419419impl Primitive for Ref {
420- const HAS_DELIMITER : bool = false ;
420+ const STARTS_WITH_DELIMITER : bool = false ;
421421
422422 #[ inline]
423423 fn write ( self , buf : & mut Buf ) {
@@ -455,7 +455,7 @@ impl Rect {
455455}
456456
457457impl Primitive for Rect {
458- const HAS_DELIMITER : bool = true ;
458+ const STARTS_WITH_DELIMITER : bool = true ;
459459
460460 #[ inline]
461461 fn write ( self , buf : & mut Buf ) {
@@ -572,7 +572,7 @@ impl Date {
572572}
573573
574574impl Primitive for Date {
575- const HAS_DELIMITER : bool = true ;
575+ const STARTS_WITH_DELIMITER : bool = true ;
576576
577577 fn write ( self , buf : & mut Buf ) {
578578 buf. extend ( b"(D:" ) ;
@@ -654,7 +654,7 @@ impl<'a> Obj<'a> {
654654 let ends_with_delimiter =
655655 self . buf . last ( ) . copied ( ) . is_some_and ( is_delimiter_character) ;
656656
657- if self . needs_padding && !T :: HAS_DELIMITER && !ends_with_delimiter {
657+ if self . needs_padding && !T :: STARTS_WITH_DELIMITER && !ends_with_delimiter {
658658 self . buf . extend ( b" " ) ;
659659 }
660660
0 commit comments