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

feat: add TryFrom impls for SubstateId and Addresses #1243

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

humb1t
Copy link
Contributor

@humb1t humb1t commented Jan 15, 2025

Description

Associated error type for impl TryFrom<SubstateId> for A was changed from SubstateId to an error type which wraps id. Implementations for main variants were provided.

Motivation and Context

For users of Tari SDK it's important to convert SubstateId into one of subvariants (for example into ComponentAddress). Unfortunately as_T methods return not an error type, but Option, which makes it verbose to manually wrap into own error types for handling. Existing implementation for ComponentAddress has associated type for error which doesn't implement error trait from Rust standard library. To improve developers experience new error type with some out of the box implementations proposed in this PR.

How Has This Been Tested?

  • Cargo builds
  • CI

What process can a PR reviewer use to test or verify this change?

This change should not affect anything, so additional testing may not be needed.

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

sdbondi
sdbondi previously approved these changes Jan 15, 2025
Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Thanks

dan_layer/engine_types/src/substate.rs Outdated Show resolved Hide resolved
@sdbondi sdbondi enabled auto-merge January 15, 2025 11:58
@sdbondi sdbondi changed the title feat: Add TryFrom impls for SubstateId and Addresses feat: add TryFrom impls for SubstateId and Addresses Jan 15, 2025
@sdbondi sdbondi disabled auto-merge January 16, 2025 12:39
@sdbondi sdbondi merged commit 9500de9 into tari-project:development Jan 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants