-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gaius <[email protected]>
- Loading branch information
Showing
9 changed files
with
1,009 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ readme = "README.md" | |
edition = "2021" | ||
|
||
[dependencies] | ||
thiserror = "1.0" | ||
rand = "0.8" | ||
bytes = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2025 The Dragonfly Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/// Error is the error type for the Vortex protocol. | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
/// InvalidPacket indicates an invalid Vortex packet. | ||
#[error("invalid vortex packet, cause: {0}")] | ||
InvalidPacket(String), | ||
|
||
/// InvalidLength indicates an invalid length. | ||
#[error("invalid length, cause: {0}")] | ||
InvalidLength(String), | ||
|
||
/// TryFromSliceError indicates a conversion error. | ||
#[error(transparent)] | ||
TryFromSliceError(#[from] std::array::TryFromSliceError), | ||
|
||
/// Utf8Error indicates a conversion error. | ||
#[error(transparent)] | ||
Utf8Error(#[from] std::str::Utf8Error), | ||
|
||
/// ParseIntError indicates a conversion error. | ||
#[error(transparent)] | ||
ParseIntError(#[from] std::num::ParseIntError), | ||
|
||
/// FromUtf8Error indicates a conversion error. | ||
#[error(transparent)] | ||
FromUtf8Error(#[from] std::string::FromUtf8Error), | ||
} | ||
|
||
/// Result is the result type for the Vortex protocol. | ||
pub type Result<T> = std::result::Result<T, Error>; |
Oops, something went wrong.