Skip to content

Commit

Permalink
Rename response methods
Browse files Browse the repository at this point in the history
Signed-off-by: Mikail Bagishov <bagishov.mikail@yandex.ru>
  • Loading branch information
MikailBag committed Sep 6, 2022
1 parent a3d36ec commit 307f4c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kube-core/src/conversion/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ pub struct ConversionResponse {
impl ConversionResponse {
/// Creates a new response, matching provided request
///
/// Returned response is empty: you should call `success` or `error`
/// to get a complete `ConversionResponse`.
/// This response must be finalized with one of:
/// - [`ConversionResponse::success`] when conversion succeeded
/// - [`ConversionResponse::failure`] when conversion failed
pub fn for_request(request: ConversionRequest) -> Self {
ConversionResponse {
types: request.types,
Expand Down Expand Up @@ -129,7 +130,7 @@ impl ConversionResponse {
///
/// `request_uid` must be equal to the `.uid` field in the request.
/// `message` and `reason` will be returned to the apiserver.
pub fn error(mut self, message: &str, reason: &str) -> Self {
pub fn failure(mut self, message: &str, reason: &str) -> Self {
self.result = Status::failure(message, reason);
self
}
Expand All @@ -138,7 +139,7 @@ impl ConversionResponse {
///
/// You should only call this function when request couldn't be parsed into [`ConversionRequest`].
/// Otherwise use `error`.
pub fn unmatched_error(message: &str, reason: &str) -> Self {
pub fn invalid(message: &str, reason: &str) -> Self {
ConversionResponse {
types: None,
uid: String::new(),
Expand Down

0 comments on commit 307f4c8

Please sign in to comment.