Skip to content

Various fixes in regards to NewType pattern and initialization

David Runge requested to merge dvzrv/newtype into main

Use tuple structs for BuildDate, CompressedSize, Md5Sum, Epoch, Pkgrel and Pkgver, as they only wrap one type each. Add inner() method for AbsolutePath, BuildDate, BuildDir, BuildEnv, BuildTool, CompressedSize, Epoch, Md5Sum, Name, PackageOption, Pkgrel, Pkgver and SchemaVersion, to allow accessing a reference of the inner type and replace the use of deref() which is meant to be used for raw pointers.

Remove the implementation of the Deref trait from all types since deref() is only meant to be called on raw pointers.

Consolidate Name::validate() with Name::new(), as the former is not needed on its own. Use String parameter in Name::new() and Md5Sum::new() to not clone() in all cases.

Fixes #14 (closed) Fixes #13 (closed)

Merge request reports