Rename methods

This commit is contained in:
micialware committed 2026-08-30 19:22:28 +03:00
1 parent b006ece0c1
commit 3ac7cd068b
3 files changed
+125 -86

No files matched your search

+11 -12
View File
@@ -1,4 +1,3 @@
use std::cmp::Ordering;
use crate::app::AppState;
use crate::core::srs::{FADE_PER_DAY, MAX_SCORE, OrderMode, WordOpenMode};
use crate::data::{INVALID_ID, Id};
@@ -7,6 +6,7 @@ use chrono::{DateTime, Utc};
use log::info;
use rayon::prelude::*;
use rhai::{Engine, Scope};
use std::cmp::Ordering;
use std::collections::HashMap;
use std::marker::PhantomData;
use std::time::Instant;
@@ -184,24 +184,23 @@ pub struct EntityHandle<E> {
pub(crate) id: Id,
index: i32,
pub(crate) _phantom: PhantomData<E>,
}
impl<T> Clone for EntityHandle<T> {
fn clone(&self) -> Self {
EntityHandle{
EntityHandle {
id: self.id,
index: self.index,
_phantom: Default::default(),
}
}
}
impl<T> EntityHandle<T> {
impl<T> EntityHandle<T> {
pub fn new(id: Id, index: usize, real: bool) -> Self {
Self {
id,
index : index as i32 | (!real as i32) << 31,
_phantom: Default::default()
index: index as i32 | (!real as i32) << 31,
_phantom: Default::default(),
}
}
pub fn index(&self) -> usize {
@@ -236,18 +235,18 @@ impl<T> PartialOrd<Self> for EntityHandle<T> {
impl<T> Ord for EntityHandle<T> {
fn cmp(&self, other: &Self) -> Ordering {
if self.real() && !other.real() {
return Ordering::Less
return Ordering::Less;
}
if !self.real() && other.real(){
return Ordering::Greater
if !self.real() && other.real() {
return Ordering::Greater;
}
self.id.cmp(&other.id)
}
}
pub trait EntityData{
pub trait EntityData {
fn id(&self) -> Id;
fn set_id(&mut self, id: Id);
}