mirror of
https://github.com/mbilker/vgpu_unlock-rs.git
synced 2026-01-17 20:07:00 +01:00
lib: trim trailing NUL bytes from the signature field
This commit is contained in:
16
src/lib.rs
16
src/lib.rs
@@ -251,11 +251,20 @@ impl fmt::Debug for VgpuStart {
|
|||||||
|
|
||||||
impl fmt::Debug for VgpuConfig {
|
impl fmt::Debug for VgpuConfig {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let vgpu_signature = self.vgpu_signature[..]
|
||||||
|
.split(|&x| x == 0)
|
||||||
|
.next()
|
||||||
|
.unwrap_or(&[]);
|
||||||
|
let vgpu_extra_params = self.vgpu_extra_params[..]
|
||||||
|
.split(|&x| x == 0)
|
||||||
|
.next()
|
||||||
|
.unwrap_or(&[]);
|
||||||
|
|
||||||
f.debug_struct("VgpuConfig")
|
f.debug_struct("VgpuConfig")
|
||||||
.field("vgpu_type", &self.vgpu_type)
|
.field("vgpu_type", &self.vgpu_type)
|
||||||
.field("vgpu_name", &CStrFormat(&self.vgpu_name))
|
.field("vgpu_name", &CStrFormat(&self.vgpu_name))
|
||||||
.field("vgpu_class", &CStrFormat(&self.vgpu_class))
|
.field("vgpu_class", &CStrFormat(&self.vgpu_class))
|
||||||
.field("vgpu_signature", &HexFormatSlice(&self.vgpu_signature))
|
.field("vgpu_signature", &HexFormatSlice(vgpu_signature))
|
||||||
.field("features", &CStrFormat(&self.features))
|
.field("features", &CStrFormat(&self.features))
|
||||||
.field("max_instances", &self.max_instances)
|
.field("max_instances", &self.max_instances)
|
||||||
.field("num_heads", &self.num_heads)
|
.field("num_heads", &self.num_heads)
|
||||||
@@ -288,10 +297,7 @@ impl fmt::Debug for VgpuConfig {
|
|||||||
"licensed_product_name",
|
"licensed_product_name",
|
||||||
&CStrFormat(&self.licensed_product_name),
|
&CStrFormat(&self.licensed_product_name),
|
||||||
)
|
)
|
||||||
.field(
|
.field("vgpu_extra_params", &HexFormatSlice(vgpu_extra_params))
|
||||||
"vgpu_extra_params",
|
|
||||||
&HexFormatSlice(&self.vgpu_extra_params[..]),
|
|
||||||
)
|
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user