BogoSorting

Struct BogoSorting 

Source
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>

Sourceยง

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>>

Obtain a sorting Result from a Sorting, by sorting the data.
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>

ยง

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> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V