MCPcopy Create free account
hub / github.com/bitflags/bitflags / to_writer_strict

Function to_writer_strict

src/parser.rs:165–181  ·  view source on GitHub ↗

Write only the contained, defined, named flags in a flags value as text. */

(flags: &B, mut writer: impl Write)

Source from the content-addressed store, hash-verified

163Write only the contained, defined, named flags in a flags value as text.
164*/
165pub fn to_writer_strict<B: Flags>(flags: &B, mut writer: impl Write) -> Result<(), fmt::Error> {
166 // This is a simplified version of `to_writer` that ignores
167 // any bits not corresponding to a named flag
168
169 let mut first = true;
170 let mut iter = flags.iter_names();
171 for (name, _) in &mut iter {
172 if !first {
173 writer.write_str(" | ")?;
174 }
175
176 first = false;
177 writer.write_str(name)?;
178 }
179
180 fmt::Result::Ok(())
181}
182
183/**
184Parse a flags value from text.

Callers 3

roundtrip_strictFunction · 0.85
writeFunction · 0.85
formatFunction · 0.85

Calls 2

OkClass · 0.85
iter_namesMethod · 0.80

Tested by 2

roundtrip_strictFunction · 0.68
writeFunction · 0.68