Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result doc comments #605

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/result/decoding_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::borrow::Cow;
use thiserror::Error;

/// Indicates that a read operation failed due to invalid input.
#[derive(Clone, Debug, Error, PartialEq)]
#[error("{description}")]
pub struct DecodingError {
Expand Down
1 change: 1 addition & 0 deletions src/result/encoding_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::borrow::Cow;
use thiserror::Error;

/// Indicates that a write operation failed to serialize the given data.
#[derive(Clone, Debug, Error, PartialEq)]
#[error("{description}")]
pub struct EncodingError {
Expand Down
2 changes: 2 additions & 0 deletions src/result/illegal_operation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::borrow::Cow;
use thiserror::Error;

/// Indicates that the user has performed an operation that was not legal in the application's
/// current state.
#[derive(Clone, Debug, Error, PartialEq)]
#[error("the user has performed an operation that is not legal in the current state: {operation}")]
pub struct IllegalOperation {
Expand Down
2 changes: 2 additions & 0 deletions src/result/incomplete.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use crate::position::Position;
use thiserror::Error;

/// For non-blocking readers, indicates that there was not enough data available in the input buffer
/// to complete the requested action.
#[derive(Clone, Debug, Error, PartialEq)]
#[error("ran out of input while reading {label} at offset {position}")]
pub struct IncompleteError {
Expand Down
1 change: 1 addition & 0 deletions src/result/io_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::io;
use thiserror::Error;

/// Indicates that a read or write operation failed due to an I/O error.
#[derive(Debug, Error)]
#[error("{source:?}")]
pub struct IoError {
Expand Down
2 changes: 2 additions & 0 deletions src/result/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Types for reporting various modes of success or failure.

use std::borrow::Cow;
use std::convert::From;
use std::fmt::{Debug, Error};
Expand Down
12 changes: 6 additions & 6 deletions src/types/decimal/coefficient.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! A representation of a decimal value's coefficient.

use num_bigint::{BigInt, BigUint};
use num_traits::Zero;

Expand All @@ -10,18 +12,16 @@ use std::convert::TryFrom;
use std::fmt::{Display, Formatter};
use std::ops::{MulAssign, Neg};

/// Indicates whether the Coefficient's magnitude is less than 0 (negative) or not (positive).
/// When the magnitude is zero, the Sign can be used to distinguish between -0 and 0.
/// Indicates whether the `Coefficient`'s magnitude is less than 0 (negative) or not (positive).
/// When the magnitude is zero, the `Sign` can be used to distinguish between -0 and 0.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub enum Sign {
Negative,
Positive,
}

/// A signed integer that can be used as the coefficient of a Decimal value. This type does not
/// consider `0` and `-0` to be equal and supports magnitudes of arbitrary size.
// These trait derivations rely closely on the manual implementations of PartialEq and Ord on
// [Magnitude].
/// A signed integer that can be used as the coefficient of a [`Decimal`](crate::Decimal) value.
/// This type does not consider `0` and `-0` to be equal and supports magnitudes of arbitrary size.
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
pub struct Coefficient {
pub(crate) sign: Sign,
Expand Down
2 changes: 2 additions & 0 deletions src/types/decimal/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Types related to [`Decimal`], the in-memory representation of an Ion decimal value.

use std::cmp::{max, Ordering};

use num_bigint::{BigInt, BigUint, ToBigInt, ToBigUint};
Expand Down
Loading