And(FuncRes) |
Combines two results: this and other as follows:
- returns this if both are Ok;
- returns the error if one of the results is an Err;
- returns the combined error if both results are Err.
var combined = Ok(12).And(Ok());
Assert.Equal(Ok(12), combined);
combined = Ok(12).And(Err("failure"));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Ok());
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Err("failure"));
Assert.True(combined.IsErr);
|
And(Res) |
Combines two results: this and other as follows:
- returns this if both are Ok;
- returns the error if one of the results is an Err;
- returns the combined error if both results are Err.
var combined = Ok(12).And(Ok());
Assert.Equal(Ok(12), combined);
combined = Ok(12).And(Err("failure"));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Ok());
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Err("failure"));
Assert.True(combined.IsErr);
|
AndT2(FuncResT2) |
Combines two results: this and other as follows:
- returns Ok of a tuple of both values if both results are Ok;
- returns the error if one of the results is an Err;
- returns the combined error if both results are Err.
var combined = Ok(12).And(Ok(true));
Assert.Equal(Ok((12, true)), combined);
combined = Ok(12).And(Err<bool>("failure"));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Ok(true));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Err<bool>("failure"));
Assert.True(combined.IsErr);
|
AndT2(ResT2) |
Combines two results: this and other as follows:
- returns Ok of a tuple of both values if both results are Ok;
- returns the error if one of the results is an Err;
- returns the combined error if both results are Err.
var combined = Ok(12).And(Ok(true));
Assert.Equal(Ok((12, true)), combined);
combined = Ok(12).And(Err<bool>("failure"));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Ok(true));
Assert.True(combined.IsErr);
combined = Err<int>("error").And(Err<bool>("failure"));
Assert.True(combined.IsErr);
|