mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 10:07:40 +08:00
Attempt pushing bad code in order to stop stuck GitHub action
This commit is contained in:
parent
0419b93032
commit
544961372c
@ -2,7 +2,7 @@ use std::convert::Infallible;
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use bitflags::bitflags;
|
use bitflags::{bitflags, Flags};
|
||||||
use deserr::{take_cf_content, DeserializeError, Deserr, MergeWithError, ValuePointerRef};
|
use deserr::{take_cf_content, DeserializeError, Deserr, MergeWithError, ValuePointerRef};
|
||||||
use enum_iterator::Sequence;
|
use enum_iterator::Sequence;
|
||||||
use milli::update::Setting;
|
use milli::update::Setting;
|
||||||
@ -291,15 +291,6 @@ impl Action {
|
|||||||
.map(|(serde_name, _)| serde_name)
|
.map(|(serde_name, _)| serde_name)
|
||||||
.expect("an action is missing a matching serialized value")
|
.expect("an action is missing a matching serialized value")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_index(&self) -> usize {
|
|
||||||
Self::SERDE_MAP_ARR
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
|
||||||
.find(|(_, (_, action))| action == self)
|
|
||||||
.map(|(i, _)| i)
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod actions {
|
pub mod actions {
|
||||||
@ -409,28 +400,51 @@ impl Sequence for Action {
|
|||||||
const CARDINALITY: usize = Self::SERDE_MAP_ARR.len();
|
const CARDINALITY: usize = Self::SERDE_MAP_ARR.len();
|
||||||
|
|
||||||
fn next(&self) -> Option<Self> {
|
fn next(&self) -> Option<Self> {
|
||||||
let next_index = self.get_index() + 1;
|
let mut iter = Self::FLAGS.iter();
|
||||||
if next_index == Self::CARDINALITY {
|
while let Some(action) = iter.next() {
|
||||||
None
|
if action.value() == self {
|
||||||
} else {
|
if let Some(action) = iter.next() {
|
||||||
Some(Self::SERDE_MAP_ARR[next_index].1)
|
return Some(*action.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Non
|
||||||
}
|
}
|
||||||
|
|
||||||
fn previous(&self) -> Option<Self> {
|
fn previous(&self) -> Option<Self> {
|
||||||
let current_index = self.get_index();
|
let mut iter = Self::FLAGS.iter().peekable();
|
||||||
if current_index == 0 {
|
|
||||||
None
|
if let Some(action) = iter.next() {
|
||||||
} else {
|
if action.value() == self {
|
||||||
Some(Self::SERDE_MAP_ARR[current_index - 1].1)
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(next_action) = iter.peek() {
|
||||||
|
if next_action.value() == self {
|
||||||
|
return Some(*action.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while let Some(action) = iter.next() {
|
||||||
|
if let Some(next_action) = iter.peek() {
|
||||||
|
if next_action.value() == self {
|
||||||
|
return Some(*action.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn first() -> Option<Self> {
|
fn first() -> Option<Self> {
|
||||||
Some(Self::SERDE_MAP_ARR[0].1)
|
Self::FLAGS.first().map(|v| *v.value())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn last() -> Option<Self> {
|
fn last() -> Option<Self> {
|
||||||
Some(Self::SERDE_MAP_ARR[Self::CARDINALITY - 1].1)
|
Self::FLAGS.last().map(|v| *v.value())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user