[][src]Struct rust_algorithm::Algorithm

pub struct Algorithm {}

Methods

impl Algorithm[src]

pub fn gcd_of_strings(str1: String, str2: String) -> Option<String>[src]

求两个字符串的最大公约字符串

Arguments

  • str1 - 第一个字符串
  • str2 - 第二个字符串

Examples

use rust_algorithm::Algorithm;
let result = Algorithm::gcd_of_strings(String::from("ABCABCABC"), String::from("ABC"));
assert_eq!(result.unwrap(), "ABC");

pub fn gcd(int1: i32, int2: i32) -> i32[src]

求两个数的最大公约数(greatest common divisor)

Arguments

  • int1 - 第一个数
  • int2 - 第二个数

Examples

use rust_algorithm::Algorithm;
let result = Algorithm::gcd(8, 4);
assert_eq!(result, 4);

Auto Trait Implementations

impl Send for Algorithm

impl Unpin for Algorithm

impl Sync for Algorithm

impl RefUnwindSafe for Algorithm

impl UnwindSafe for Algorithm

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]