1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use super::super::Collate;
use super::DefaultCollate;
use std::ffi::{CStr, CString, OsString};

impl Collate<String> for DefaultCollate {
    type Output = Vec<String>;
    fn collate(&self, batch: Vec<String>) -> Self::Output {
        batch
    }
}

impl<'a> Collate<&'a str> for DefaultCollate {
    type Output = Vec<&'a str>;
    fn collate(&self, batch: Vec<&'a str>) -> Self::Output {
        batch
    }
}

impl Collate<CString> for DefaultCollate {
    type Output = Vec<CString>;
    fn collate(&self, batch: Vec<CString>) -> Self::Output {
        batch
    }
}

impl<'a> Collate<&'a CStr> for DefaultCollate {
    type Output = Vec<&'a CStr>;
    fn collate(&self, batch: Vec<&'a CStr>) -> Self::Output {
        batch
    }
}

impl Collate<OsString> for DefaultCollate {
    type Output = Vec<OsString>;
    fn collate(&self, batch: Vec<OsString>) -> Self::Output {
        batch
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn no_op() {
        assert_eq!(
            DefaultCollate::default().collate(vec![String::from("a"), String::from("b")]),
            vec![String::from("a"), String::from("b")]
        );

        assert_eq!(
            DefaultCollate::default().collate(vec!["a", "b"]),
            vec!["a", "b"]
        );
    }
}