master > master: code-rust - minor
This commit is contained in:
parent
2f600e01e3
commit
2f4032b64a
@ -31,7 +31,7 @@ pub fn min<T>(x: T, y: T) -> T
|
||||
// METHODS Vectors
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
pub fn restrict<T>(x: &mut Vec<T>, i: usize, j: usize) -> Vec<T>
|
||||
pub fn restrict<T>(x: &Vec<T>, i: usize, j: usize) -> Vec<T>
|
||||
where T: Clone
|
||||
{
|
||||
return x[i..j].iter()
|
||||
@ -39,17 +39,23 @@ pub fn restrict<T>(x: &mut Vec<T>, i: usize, j: usize) -> Vec<T>
|
||||
.collect::<Vec<T>>();
|
||||
}
|
||||
|
||||
pub fn remove_last<T>(x: &mut Vec<T>) -> Vec<T>
|
||||
pub fn remove_last<T>(x: &Vec<T>) -> Vec<T>
|
||||
where T: Clone
|
||||
{
|
||||
let n = x.len();
|
||||
if n == 0 {
|
||||
return Vec::<T>::new();
|
||||
}
|
||||
return restrict::<T>(x, 0, n-1);
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn remove_first<T>(x: &mut Vec<T>) -> Vec<T>
|
||||
pub fn remove_first<T>(x: &Vec<T>) -> Vec<T>
|
||||
where T: Clone
|
||||
{
|
||||
let n = x.len();
|
||||
if n == 0 {
|
||||
return Vec::<T>::new();
|
||||
}
|
||||
return restrict::<T>(x, 0, n);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user