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
use cassandra::util::Protected;
use cassandra_sys::CassConsistency as _CassConsistency;
use cassandra_sys::cass_consistency_string;
use std::ffi::CStr;
#[derive(Debug)]
pub struct Consistency(_CassConsistency);
impl ToString for Consistency {
fn to_string(&self) -> String {
unsafe {
let my_string = cass_consistency_string(self.0);
CStr::from_ptr(my_string).to_string_lossy().into_owned()
}
}
}
impl Protected<_CassConsistency> for Consistency {
fn inner(&self) -> _CassConsistency { self.0 }
fn build(inner: _CassConsistency) -> Self { Consistency(inner) }
}