MCPcopy Index your code
hub / github.com/RizeCrime/linuxblaster_control / as_bool

Method as_bool

src/features.rs:455–468  ·  view source on GitHub ↗

Returns the bool interpretation of a Toggle feature's cached value. Panics if the value is not exactly 0.0 or 1.0 as a sanity check; a non-boolean value for a toggle means the protocol assumptions are broken and no functionality can be guaranteed.

(&self)

Source from the content-addressed store, hash-verified

453 /// a non-boolean value for a toggle means the protocol
454 /// assumptions are broken and no functionality can be guaranteed.
455 pub fn as_bool(&self) -> bool {
456 let value = self.value();
457 if value == 0.0 {
458 false
459 } else if value == 1.0 {
460 true
461 } else {
462 panic!(
463 "Toggle feature '{}' has invalid value {} (expected 0.0 or 1.0)",
464 self.id.display_name(),
465 value
466 );
467 }
468 }
469
470 /// Queries hardware for the current value, updates the cache, returns the fresh value.
471 pub fn read_from_device(&self) -> f32 {

Callers 2

nav_paneFunction · 0.80
sbx_featuresFunction · 0.80

Calls 1

valueMethod · 0.80

Tested by

no test coverage detected