fix(resultsrange): use usize min instead of usize max
All checks were successful
Build and Test / build-editions (wii-u-chat) (push) Successful in 3m7s
Build and Test / build-editions (minecraft-wiiu) (push) Successful in 3m44s
Build and Test / build-editions (DATABASE_FRIENDS, friends) (push) Successful in 3m45s
Build and Test / build-editions (sonic-transformed) (push) Successful in 4m28s
Build and Test / build-editions (terraria) (push) Successful in 5m44s
Build and Test / build-editions (fast-racing-neo) (push) Successful in 6m0s
Build and Test / build-editions (mario-tennis) (push) Successful in 6m24s
Build and Test / build-editions (splatoon-testfire) (push) Successful in 6m27s
Build and Test / build-editions (DATABASE_SMM, super-mario-maker) (push) Successful in 6m31s
Build and Test / build-editions (DATABASE_SMM, wii-sports-club) (push) Successful in 6m36s
Build and Test / build-editions (DATABASE_SMM, puyopuyo) (push) Successful in 6m37s
Build and Test / build-editions (splatoon) (push) Successful in 6m56s
All checks were successful
Build and Test / build-editions (wii-u-chat) (push) Successful in 3m7s
Build and Test / build-editions (minecraft-wiiu) (push) Successful in 3m44s
Build and Test / build-editions (DATABASE_FRIENDS, friends) (push) Successful in 3m45s
Build and Test / build-editions (sonic-transformed) (push) Successful in 4m28s
Build and Test / build-editions (terraria) (push) Successful in 5m44s
Build and Test / build-editions (fast-racing-neo) (push) Successful in 6m0s
Build and Test / build-editions (mario-tennis) (push) Successful in 6m24s
Build and Test / build-editions (splatoon-testfire) (push) Successful in 6m27s
Build and Test / build-editions (DATABASE_SMM, super-mario-maker) (push) Successful in 6m31s
Build and Test / build-editions (DATABASE_SMM, wii-sports-club) (push) Successful in 6m36s
Build and Test / build-editions (DATABASE_SMM, puyopuyo) (push) Successful in 6m37s
Build and Test / build-editions (splatoon) (push) Successful in 6m56s
This commit is contained in:
parent
3db244c2ff
commit
be7bc79762
3 changed files with 22 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -2459,6 +2459,7 @@ dependencies = [
|
|||
name = "rnex-base-protos"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"ctor",
|
||||
"rnex-rmc",
|
||||
"tracing",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
cfg-if = "1.0.4"
|
||||
ctor = "1.0.8"
|
||||
rnex-rmc = { path = "../../rnex-rmc" }
|
||||
tracing = "0.1.44"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ pub mod secure;
|
|||
pub mod util;
|
||||
use secure::{RawSecure, RawSecureInfo, RemoteSecure, Secure};
|
||||
use util::{RawUtility, RawUtilityInfo, RemoteUtility, Utility};
|
||||
use cfg_if::cfg_if;
|
||||
|
||||
#[derive(RmcSerialize, Debug, Default, Clone)]
|
||||
#[rmc_struct(0)]
|
||||
|
|
@ -13,6 +14,17 @@ pub struct ResultsRange {
|
|||
pub size: u32,
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "v3-8-13")] {
|
||||
impl ResultsRange {
|
||||
pub fn make_from_list<T: Clone>(&self, list: &[T]) -> Vec<T> {
|
||||
let start = (self.offset as usize).min(list.len());
|
||||
let end = (start + self.size as usize).min(list.len());
|
||||
|
||||
list[start..end].to_vec()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
impl ResultsRange {
|
||||
pub fn make_from_list<T: Clone>(&self, list: &[T]) -> Vec<T> {
|
||||
let end = usize::max(list.len(), self.offset as usize + self.size as usize);
|
||||
|
|
@ -22,6 +34,8 @@ impl ResultsRange {
|
|||
.into()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
define_rmc_proto!(
|
||||
proto BaseProtocol{
|
||||
|
|
|
|||
Loading…
Reference in a new issue