MCPcopy Create free account
hub / github.com/SeaQL/FireDBG.for.Rust / write_option

Method write_option

debugger/src/debugger.rs:1110–1127  ·  view source on GitHub ↗
(
        &mut self,
        rwriter: &mut RValueWriter,
        name: &str,
        ty: &str,
        val: Option<Bytes>,
    )

Source from the content-addressed store, hash-verified

1108 }
1109
1110 fn write_option(
1111 &mut self,
1112 rwriter: &mut RValueWriter,
1113 name: &str,
1114 ty: &str,
1115 val: Option<Bytes>,
1116 ) {
1117 let option_enum = UnionType {
1118 name: trim_type_name(ty),
1119 variants: vec!["None".to_owned(), "Some".to_owned()],
1120 };
1121 let bytes = if let Some(val) = val {
1122 rwriter.union_v(&option_enum, 1, [("0".to_owned(), val)].into_iter())
1123 } else {
1124 rwriter.union_v(&option_enum, 0, [].into_iter())
1125 };
1126 self.write_value(rwriter, name, bytes.as_bytes());
1127 }
1128
1129 fn write_string(&mut self, rwriter: &mut RValueWriter, name: &str, value: &str) {
1130 self.identifier(name);

Callers 1

write_return_valueFunction · 0.80

Calls 4

trim_type_nameFunction · 0.85
as_bytesMethod · 0.80
union_vMethod · 0.45
write_valueMethod · 0.45

Tested by

no test coverage detected