pub struct BogoSorting<'a, 'b, O: Optimizer, T: Ord + Copy + Sync + Send + Debug + Clone + PartialEq> { /* private fields */ }Expand description
Bogo++ Sorting Example usage:
use bogo_plus_plus::{AudentisOptimizer, BogoConfig, BogoSorting, SortingResultKind, score_one_default, Sorting};
let optimizer = AudentisOptimizer::default();
let mut config = BogoConfig {
give_up_count: 1000,
verbose: false,
population_size: 10,
optimizer,
scoring_function: score_one_default
};
// Sort
let data = vec![1, -1, 10, 3, 12, 3, 100];
let sorting = BogoSorting::new(&data, &mut config);
let result = sorting.sorting_get_sorted_result();
let result_kind = result.get_inner_sorting_result_kind();
assert_eq!(result_kind, &SortingResultKind::SortingWasOkKindResult(vec![-1, 1, 3, 3, 10, 12, 100]));This sorts the list [1, -1, 10, 3, 12, 3, 100] using the BogoSorting and the Audentis optimizer.
Trait Implementationsยง
Sourceยงimpl<'a, 'b, O: Optimizer, T: Ord + Copy + Sync + Send + Debug + Clone + PartialEq> Sorting<'a, 'b, T, BogoConfig<O, T>> for BogoSorting<'a, 'b, O, T>
impl<'a, 'b, O: Optimizer, T: Ord + Copy + Sync + Send + Debug + Clone + PartialEq> Sorting<'a, 'b, T, BogoConfig<O, T>> for BogoSorting<'a, 'b, O, T>
Sourceยงfn new(data: &'a [T], config: &'b mut BogoConfig<O, T>) -> Self
fn new(data: &'a [T], config: &'b mut BogoConfig<O, T>) -> Self
Creates a Sorting bound to some data and some Config
Sourceยงfn sorting_get_sorted_result(self) -> SortingResult<'b, T, BogoConfig<O, T>>
fn sorting_get_sorted_result(self) -> SortingResult<'b, T, BogoConfig<O, T>>
Obtain a sorting Result from a Sorting, by sorting the data.
This call consumes the Sorting
This call consumes the Sorting
Auto Trait Implementationsยง
impl<'a, 'b, O, T> Freeze for BogoSorting<'a, 'b, O, T>
impl<'a, 'b, O, T> RefUnwindSafe for BogoSorting<'a, 'b, O, T>where
T: RefUnwindSafe,
O: RefUnwindSafe,
impl<'a, 'b, O, T> Send for BogoSorting<'a, 'b, O, T>where
O: Send,
impl<'a, 'b, O, T> Sync for BogoSorting<'a, 'b, O, T>where
O: Sync,
impl<'a, 'b, O, T> Unpin for BogoSorting<'a, 'b, O, T>where
T: Unpin,
impl<'a, 'b, O, T> !UnwindSafe for BogoSorting<'a, 'b, O, T>
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more