refactor: Move lib/types into lib/xmpp

This commit is contained in:
PapaTutuWawa 2022-01-25 15:46:34 +01:00
parent 7d5b389f35
commit cc52fa9128
5 changed files with 16 additions and 12 deletions

View File

@ -1,9 +0,0 @@
class Result<S, V> {
final S _state;
final V _value;
Result(S state, V value) : _state = state, _value = value;
S getState() => _state;
V getValue() => _value;
}

View File

@ -1,5 +1,5 @@
import "package:moxxyv2/xmpp/stringxml.dart"; import "package:moxxyv2/xmpp/stringxml.dart";
import "package:moxxyv2/types/result.dart"; import "package:moxxyv2/xmpp/types/result.dart";
enum AuthenticationResult { enum AuthenticationResult {
success, success,

View File

@ -1,6 +1,6 @@
import "dart:convert"; import "dart:convert";
import "package:moxxyv2/types/result.dart"; import "package:moxxyv2/xmpp/types/result.dart";
import "package:moxxyv2/xmpp/stringxml.dart"; import "package:moxxyv2/xmpp/stringxml.dart";
import "package:moxxyv2/xmpp/sasl/authenticator.dart"; import "package:moxxyv2/xmpp/sasl/authenticator.dart";
import "package:moxxyv2/xmpp/sasl/errors.dart"; import "package:moxxyv2/xmpp/sasl/errors.dart";

View File

@ -1,7 +1,7 @@
import "dart:convert"; import "dart:convert";
import "dart:math" show Random; import "dart:math" show Random;
import "package:moxxyv2/types/result.dart"; import "package:moxxyv2/xmpp/types/result.dart";
import "package:moxxyv2/xmpp/stringxml.dart"; import "package:moxxyv2/xmpp/stringxml.dart";
import "package:moxxyv2/xmpp/sasl/authenticator.dart"; import "package:moxxyv2/xmpp/sasl/authenticator.dart";
import "package:moxxyv2/xmpp/sasl/errors.dart"; import "package:moxxyv2/xmpp/sasl/errors.dart";

View File

@ -0,0 +1,13 @@
/// Class that is supposed to by used with a state type S and a value type V.
/// The state indicates if an action was successful or not, while the value
/// type indicates the return value, i.e. a result in a computation or the
/// actual error description.
class Result<S, V> {
final S _state;
final V _value;
Result(S state, V value) : _state = state, _value = value;
S getState() => _state;
V getValue() => _value;
}