MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / increment_by

Method increment_by

tests/binary/impl/src/main.rs:78–96  ·  view source on GitHub ↗

Increment the counter by a specific amount. Clamps at the limit. Returns the actual amount the counter was incremented by.

(&mut self, amount: u32)

Source from the content-addressed store, hash-verified

76
77 // Check if the counter is enabled
78 fn is_enabled(&self) -> bool {
79 self.enabled
80 }
81
82 // Check if the counter has reached its limit
83 fn is_at_limit(&self) -> bool {
84 // Example of calling other &self methods
85 self.get_count() >= self.get_limit()
86 }
87
88 // --- Methods taking &mut self (Mutable Access) ---
89
90 // Increment the counter by 1, respecting the limit and enabled status.
91 // Returns true if incremented, false otherwise.
92 fn increment(&mut self) -> bool {
93 if !self.enabled {
94 // Not enabled, cannot increment
95 return false;
96 }
97 if self.is_at_limit() { // Calls &self method `is_at_limit`
98 // Already at limit, cannot increment
99 return false;

Callers 1

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected