Make internals for CommandString private
The From traits and AsRef and Display implementations let you do all you want.
This commit is contained in:
parent
83f55b7f1d
commit
671b3173c8
|
@ -35,7 +35,7 @@ use consensus::encode::MAX_VEC_SIZE;
|
|||
|
||||
/// Serializer for command string
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub struct CommandString(pub Cow<'static, str>);
|
||||
pub struct CommandString(Cow<'static, str>);
|
||||
|
||||
impl fmt::Display for CommandString {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
@ -55,6 +55,12 @@ impl From<String> for CommandString {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for CommandString {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.0.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl Encodable for CommandString {
|
||||
#[inline]
|
||||
fn consensus_encode<S: io::Write>(
|
||||
|
|
Loading…
Reference in New Issue