Skip to content

Commit

Permalink
Merge pull request #94 from a-givertzman/result-extensions
Browse files Browse the repository at this point in the history
Included Result extensions into export files
  • Loading branch information
Minyewoo authored Nov 7, 2024
2 parents b79f50d + f8a07ff commit aab7407
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 15 deletions.
8 changes: 6 additions & 2 deletions lib/hmi_core.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
library hmi_core;

// Entities
export 'src/core/entities/ds_data_class.dart';
export 'src/core/entities/ds_data_point.dart';
Expand All @@ -23,6 +22,11 @@ export 'src/core/log/log_level.dart';
export 'src/core/option/option.dart';
// Result
export 'src/core/result/result.dart';
export 'src/core/result/result_adapter_extension.dart';
export 'src/core/result/result_boolean_operations_extension.dart';
export 'src/core/result/result_extract_extension.dart';
export 'src/core/result/result_querying_extension.dart';
export 'src/core/result/result_transform_extension.dart';
// ValueObject
export 'src/core/value_object/value_object.dart';
export 'src/core/value_object/value_string.dart';
Expand Down Expand Up @@ -51,4 +55,4 @@ export 'src/translate/app_lang.dart';
export 'src/translate/localizations.dart';
export 'src/translate/localized.dart';
// State
export 'src/core/operation_state.dart';
export 'src/core/operation_state.dart';
8 changes: 6 additions & 2 deletions lib/hmi_core_result.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
library hmi_core_result;

export 'src/core/result/result.dart';
export 'src/core/result/result.dart';
export 'src/core/result/result_adapter_extension.dart';
export 'src/core/result/result_boolean_operations_extension.dart';
export 'src/core/result/result_extract_extension.dart';
export 'src/core/result/result_querying_extension.dart';
export 'src/core/result/result_transform_extension.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:hmi_core/hmi_core_option.dart';
import 'package:hmi_core/hmi_core_result.dart';
///
/// Adapter for each variant
extension Adapter<V, E> on Result<V, E> {
extension ResultAdapter<V, E> on Result<V, E> {
///
/// Converts from `Result<V, E>` to `Option<V>`.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import 'package:hmi_core/hmi_core_result.dart';
/// | `orElse` | `Err(e)` | `e` | `Err(d)` | `Err(d)` |
/// | `orElse` | `Err(e)` | `e` | `Ok(y)` | `Ok(y)` |
/// | `orElse` | `Ok(x)` | (not provided) | (not evaluated) | `Ok(x)` |
extension BooleanOperations<V, E> on Result<V, E> {
extension ResultBooleanOperations<V, E> on Result<V, E> {
///
/// Returns [result] if the result is [Ok], otherwise returns the [Err] value of `this`.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:hmi_core/hmi_core_failure.dart';
import 'package:hmi_core/hmi_core_result.dart';
///
/// Extracting contained values
extension Extract<V, E> on Result<V, E> {
extension ResultExtract<V, E> on Result<V, E> {
///
/// Returns the contained [Ok] value, consuming the `this` value.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:hmi_core/hmi_core_result.dart';
///
/// Querying the contained values
extension Querying<V, E> on Result<V, E> {
extension ResultQuerying<V, E> on Result<V, E> {
///
/// Returns `true` if the result is [Ok], and `false` otherwise.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:hmi_core/hmi_core_result.dart';
///
/// Transforming contained values
extension Transform<V, E> on Result<V, E> {
extension ResultTransform<V, E> on Result<V, E> {
///
/// Maps a `Result<V, E>` to `Result<U, E>` by applying a function to a
/// contained [Ok] value, leaving an [Err] value untouched.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hmi_core
description: A Flutter core package of hmi_widgets package which is helps to visualize states, values, changes and other artefacts from technological processes.
version: 2.0.0
version: 2.1.1
homepage: https://github.com/a-givertzman/hmi_core

environment:
Expand Down
1 change: 0 additions & 1 deletion test/unit/core/result/result_adapter_extensions_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core_option.dart';
import 'package:hmi_core/hmi_core_result.dart';
import 'package:hmi_core/src/core/result/extension_adapter.dart';
//
void main() {
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core_result.dart';
import 'package:hmi_core/src/core/result/extension_boolean_operations.dart';
//
void main() {
//
Expand Down
1 change: 0 additions & 1 deletion test/unit/core/result/result_extract_extensions_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core_failure.dart';
import 'package:hmi_core/hmi_core_result.dart';
import 'package:hmi_core/src/core/result/extension_extract.dart';
//
void main() {
//
Expand Down
1 change: 0 additions & 1 deletion test/unit/core/result/result_querying_extensions_test.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core_result.dart';
import 'package:hmi_core/src/core/result/extension_querying.dart';
//
void main() {
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core_result.dart';
import 'package:hmi_core/src/core/result/extension_transform.dart';
//
void main() {
//
Expand Down

0 comments on commit aab7407

Please sign in to comment.