Skip to content
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
6 changes: 6 additions & 0 deletions core/src/hlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,12 @@ where
/// then `list.sculpt()` should "just work" even without the trait.
///
/// [`HCons::sculpt`]: struct.HCons.html#method.sculpt
#[diagnostic::on_unimplemented(
message = "Cannot sculpt `{Self}` into the target HList shape",
label = "Sculpture failed",
note = "The source HList must contain all the types needed for the target HList.",
note = "Make sure all required types are present in the source, possibly in a different order."
)]
pub trait Sculptor<Target, Indices> {
type Remainder;

Expand Down
19 changes: 19 additions & 0 deletions core/src/labelled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ use core::marker::PhantomData;
/// // representation of the source object to that of the target type
/// let s_user: SavedUser = frunk::transform_from(n_user); // done
/// # }
#[diagnostic::on_unimplemented(
message = "Cannot derive labelled generic representation for `{Self}`",
label = "LabelledGeneric not implemented",
note = "The type must have a LabelledGeneric instance to be used with transform_from or transmogrify.",
note = "Derive LabelledGeneric using #[derive(LabelledGeneric)] on your struct or enum."
)]
pub trait LabelledGeneric {
/// The labelled generic representation type.
type Repr;
Expand Down Expand Up @@ -586,6 +592,12 @@ where
}

/// Trait for plucking out a `Field` from a type by type-level `TargetKey`.
#[diagnostic::on_unimplemented(
message = "Cannot find field with key `{TargetKey}` in `{Self}`",
label = "Field not found",
note = "The source type does not contain a field with the target key.",
note = "Make sure the field name exists in the source struct and matches exactly."
)]
pub trait ByNameFieldPlucker<TargetKey, Index> {
type TargetValue;
type Remainder;
Expand Down Expand Up @@ -752,6 +764,13 @@ where
///
/// Credit:
/// 1. Haskell "transmogrify" Github repo: <https://github.com/ivan-m/transmogrify>
#[diagnostic::on_unimplemented(
message = "Cannot transmogrify `{Self}` into `{Target}`",
label = "Cannot convert this type into the target type",
note = "Transmogrify requires that the source and target types have compatible structures.",
note = "The source type must have all the fields needed for the target type, possibly in a different order or nested structure.",
note = "Check that field names match and types are compatible between the source and target."
)]
pub trait Transmogrifier<Target, TransmogrifyIndexIndices> {
/// Consume this current object and return an object of the Target type.
///
Expand Down
1 change: 0 additions & 1 deletion core/src/tuples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
//! ```

use crate::generic::Generic;
use crate::{hlist, HList};

macro_rules! tup_def {
( $($dtype: ident),* ; ; ) => {};
Expand Down
Loading