|
11 | 11 | //! |
12 | 12 | use crate::{rpc::RpcClient, Config, Error, Key, KeyRange, KvPair, Result, Value}; |
13 | 13 | use futures::{future, task::Context, Future, Poll}; |
14 | | -use std::{ |
15 | | - ops::{Bound, Deref}, |
16 | | - pin::Pin, |
17 | | - sync::Arc, |
18 | | - u32, |
19 | | -}; |
| 14 | +use std::{fmt, ops::Bound, pin::Pin, sync::Arc, u32}; |
20 | 15 |
|
21 | 16 | const MAX_RAW_KV_SCAN_LIMIT: u32 = 10240; |
22 | 17 |
|
@@ -310,33 +305,21 @@ impl Future for Connect { |
310 | 305 | /// let cf = ColumnFamily::from(&String::from("write")); |
311 | 306 | /// ``` |
312 | 307 | /// |
313 | | -/// This is a *wrapper type* that implements `Deref<Target=String>` so it can be used like one transparently. |
314 | | -/// |
315 | 308 | /// **But, you should not need to worry about all this:** Many functions which accept a |
316 | 309 | /// `ColumnFamily` accept an `Into<ColumnFamily>`, which means all of the above types can be passed |
317 | 310 | /// directly to those functions. |
318 | 311 | #[derive(Default, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] |
319 | 312 | pub struct ColumnFamily(String); |
320 | 313 |
|
321 | | -impl<T> From<T> for ColumnFamily |
322 | | -where |
323 | | - T: ToString, |
324 | | -{ |
| 314 | +impl<T: Into<String>> From<T> for ColumnFamily { |
325 | 315 | fn from(i: T) -> ColumnFamily { |
326 | | - ColumnFamily(i.to_string()) |
327 | | - } |
328 | | -} |
329 | | - |
330 | | -impl ColumnFamily { |
331 | | - pub fn into_inner(self) -> String { |
332 | | - self.0 |
| 316 | + ColumnFamily(i.into()) |
333 | 317 | } |
334 | 318 | } |
335 | 319 |
|
336 | | -impl Deref for ColumnFamily { |
337 | | - type Target = String; |
338 | | - fn deref(&self) -> &Self::Target { |
339 | | - &self.0 |
| 320 | +impl fmt::Display for ColumnFamily { |
| 321 | + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
| 322 | + self.0.fmt(f) |
340 | 323 | } |
341 | 324 | } |
342 | 325 |
|
|
0 commit comments