Skip to content

Commit 7336676

Browse files
committed
Reduce some visiblity
1 parent 96fbfea commit 7336676

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

rups/src/cmd.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub enum Response {
116116
}
117117

118118
impl Response {
119-
pub fn from_args(mut args: Vec<String>) -> crate::Result<Response> {
119+
pub(crate) fn from_args(mut args: Vec<String>) -> crate::Result<Response> {
120120
if args.is_empty() {
121121
return Err(ClientError::generic(
122122
"Parsing server response failed: empty line",
@@ -396,14 +396,14 @@ impl Response {
396396
}
397397
}
398398

399-
pub fn expect_ok(&self) -> crate::Result<&Response> {
399+
pub(crate) fn expect_ok(&self) -> crate::Result<&Response> {
400400
match self {
401401
Self::Ok => Ok(self),
402402
_ => Err(NutError::UnexpectedResponse.into()),
403403
}
404404
}
405405

406-
pub fn expect_begin_list(self, expected_args: &[&str]) -> crate::Result<Response> {
406+
pub(crate) fn expect_begin_list(self, expected_args: &[&str]) -> crate::Result<Response> {
407407
let expected_args = shell_words::join(expected_args);
408408
if let Self::BeginList(args) = &self {
409409
if &expected_args == args {
@@ -416,79 +416,79 @@ impl Response {
416416
}
417417
}
418418

419-
pub fn expect_var(&self) -> crate::Result<Variable> {
419+
pub(crate) fn expect_var(&self) -> crate::Result<Variable> {
420420
if let Self::Var(name, value) = &self {
421421
Ok(Variable::parse(name, value.to_owned()))
422422
} else {
423423
Err(NutError::UnexpectedResponse.into())
424424
}
425425
}
426426

427-
pub fn expect_rw(&self) -> crate::Result<Variable> {
427+
pub(crate) fn expect_rw(&self) -> crate::Result<Variable> {
428428
if let Self::Rw(name, value) = &self {
429429
Ok(Variable::parse(name, value.to_owned()))
430430
} else {
431431
Err(NutError::UnexpectedResponse.into())
432432
}
433433
}
434434

435-
pub fn expect_ups(&self) -> crate::Result<(String, String)> {
435+
pub(crate) fn expect_ups(&self) -> crate::Result<(String, String)> {
436436
if let Self::Ups(name, description) = &self {
437437
Ok((name.to_owned(), description.to_owned()))
438438
} else {
439439
Err(NutError::UnexpectedResponse.into())
440440
}
441441
}
442442

443-
pub fn expect_client(&self) -> crate::Result<String> {
443+
pub(crate) fn expect_client(&self) -> crate::Result<String> {
444444
if let Self::Client(client_ip) = &self {
445445
Ok(client_ip.to_owned())
446446
} else {
447447
Err(NutError::UnexpectedResponse.into())
448448
}
449449
}
450450

451-
pub fn expect_cmd(&self) -> crate::Result<String> {
451+
pub(crate) fn expect_cmd(&self) -> crate::Result<String> {
452452
if let Self::Cmd(name) = &self {
453453
Ok(name.to_owned())
454454
} else {
455455
Err(NutError::UnexpectedResponse.into())
456456
}
457457
}
458458

459-
pub fn expect_cmddesc(&self) -> crate::Result<String> {
459+
pub(crate) fn expect_cmddesc(&self) -> crate::Result<String> {
460460
if let Self::CmdDesc(description) = &self {
461461
Ok(description.to_owned())
462462
} else {
463463
Err(NutError::UnexpectedResponse.into())
464464
}
465465
}
466466

467-
pub fn expect_upsdesc(&self) -> crate::Result<String> {
467+
pub(crate) fn expect_upsdesc(&self) -> crate::Result<String> {
468468
if let Self::UpsDesc(description) = &self {
469469
Ok(description.to_owned())
470470
} else {
471471
Err(NutError::UnexpectedResponse.into())
472472
}
473473
}
474474

475-
pub fn expect_desc(&self) -> crate::Result<String> {
475+
pub(crate) fn expect_desc(&self) -> crate::Result<String> {
476476
if let Self::Desc(description) = &self {
477477
Ok(description.to_owned())
478478
} else {
479479
Err(NutError::UnexpectedResponse.into())
480480
}
481481
}
482482

483-
pub fn expect_numlogins(&self) -> crate::Result<i32> {
483+
pub(crate) fn expect_numlogins(&self) -> crate::Result<i32> {
484484
if let Self::NumLogins(num) = &self {
485485
Ok(*num)
486486
} else {
487487
Err(NutError::UnexpectedResponse.into())
488488
}
489489
}
490490

491-
pub fn expect_type(&self) -> crate::Result<VariableDefinition> {
491+
pub(crate) fn expect_type(&self) -> crate::Result<VariableDefinition> {
492492
if let Self::Type(name, types) = &self {
493493
VariableDefinition::try_from((
494494
name.to_owned(),
@@ -499,15 +499,15 @@ impl Response {
499499
}
500500
}
501501

502-
pub fn expect_range(&self) -> crate::Result<VariableRange> {
502+
pub(crate) fn expect_range(&self) -> crate::Result<VariableRange> {
503503
if let Self::Range(range) = &self {
504504
Ok(range.to_owned())
505505
} else {
506506
Err(NutError::UnexpectedResponse.into())
507507
}
508508
}
509509

510-
pub fn expect_enum(&self) -> crate::Result<String> {
510+
pub(crate) fn expect_enum(&self) -> crate::Result<String> {
511511
if let Self::Enum(value) = &self {
512512
Ok(value.to_owned())
513513
} else {

0 commit comments

Comments
 (0)