Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe18fa6

Browse files
committed
Fixes for debug formatting
* Debug now prints full values for the internal representation, which is more helpful when combined with a hex or binary printing mode.* Display now properly renders all the scripts with " + " seperators.
1 parent1f84c2e commitfe18fa6

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

‎src/lib.rs‎

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl fmt::Display for Script {
131131
}
132132
}
133133

134-
#[derive(Clone,Copy,PartialEq,Eq,Hash)]
134+
#[derive(Clone,Copy,PartialEq,Eq,Hash,Debug)]
135135
#[non_exhaustive]
136136
/// A value for the `Script_Extension` property
137137
///
@@ -311,33 +311,23 @@ impl From<&'_ str> for ScriptExtension {
311311
}
312312
}
313313

314-
impl fmt::DebugforScriptExtension{
315-
fnfmt(&self,f:&mut fmt::Formatter) -> fmt::Result{
316-
write!(f,"ScriptExtension(")?;
317-
fmt::Display::fmt(self, f)?;
318-
write!(f,")")
319-
}
320-
}
321-
322314
impl fmt::DisplayforScriptExtension{
323315
fnfmt(&self,f:&mut fmt::Formatter) -> fmt::Result{
324-
ifself.is_common(){
325-
write!(f,"Common")?;
326-
}elseifself.is_inherited(){
327-
write!(f,"Inherited")?;
328-
}elseifself.is_empty(){
316+
write!(f,"ScriptExtension(")?;
317+
ifself.is_empty(){
329318
write!(f,"Unknown")?;
330319
}else{
331320
letmut first =true;
332321
for scriptinself.iter(){
333-
if !first{
334-
write!(f," + ")?;
322+
if first{
335323
first =false;
324+
}else{
325+
write!(f," + ")?;
336326
}
337327
script.full_name().fmt(f)?;
338328
}
339329
}
340-
Ok(())
330+
write!(f,")")
341331
}
342332
}
343333

@@ -361,7 +351,7 @@ impl UnicodeScript for char {
361351

362352
/// Iterator over scripts in a [ScriptExtension].
363353
///
364-
/// Can be obtainedia [ScriptExtension::iter()]
354+
/// Can be obtainedvia [ScriptExtension::iter()]
365355
pubstructScriptIterator{
366356
ext:ScriptExtension,
367357
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp