Skip to content

Releases: outfox/newtype

0.5.1

01 Feb 13:57

Choose a tag to compare

FEAT:
Implicit Conversion From Inner (wrapping) and to inner (unwrapping) and Constructor Forwarding Options parameter added.

[newtype<int>(Options = NewtypeOptions.NoImplicitWrap)]
public readonly partial struct StrictEntityId;

Options are:

    internal enum NewtypeOptions
    {
        /// <summary>All features enabled (default).</summary>
        None                    = 0,
        /// <summary>Suppress the implicit conversion from T to the alias.</summary>
        NoImplicitWrap          = 1,
        /// <summary>Suppress the implicit conversion from the alias to T.</summary>
        NoImplicitUnwrap        = 2,
        /// <summary>Suppress forwarding constructors from T.</summary>
        NoConstructorForwarding = 4,
        /// <summary>Suppress both implicit conversions.</summary>
        NoImplicitConversions   = NoImplicitWrap | NoImplicitUnwrap,
        /// <summary>Suppress implicit conversions and constructor forwarding.</summary>
        Opaque                  = NoImplicitConversions | NoConstructorForwarding,
    }

FEAT: MethodImplOptions can be overridden. They default to AggressiveInlining but in some scenarios, PGO can get you better results if left alone. For very lightweight types, there is no discernible difference.

[newtype<int>(MethodImpl = default)]
public readonly partial struct RelaxedEntityId;

Full Changelog: 0.4.0...0.5.0

0.4.0

01 Feb 13:08

Choose a tag to compare

Features:

  • .NET 8.0 support
  • .NET 9.0 support
  • (.NET 10 was already supported)

Full Changelog: 0.3.0...0.4.0

0.3.0

01 Feb 00:43
4754b01

Choose a tag to compare

What's Changed

Full Changelog: 0.2.0...0.3.0

0.2.0

31 Jan 18:40

Choose a tag to compare

fix: now supports record struct again

0.1.0

31 Jan 17:48

Choose a tag to compare

FIRST!

First release, hot off the press!

Supports:

  • structs and record structs
  • records and reference types
  • a selection of primitive types, such as int, float
  • the final boss: string

Can also be installed from nuget.

dotnet add package newtype