Skip to content

Commit

Permalink
Adjusted nullability, added methods to public API
Browse files Browse the repository at this point in the history
  • Loading branch information
Atreyu committed May 14, 2024
1 parent 512c3b8 commit 034bec1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NCrontab.Tests/CrontabScheduleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void CannotParseEmptyString()
public void TryParseNullString()
{
Assert.That(CrontabSchedule.TryParse(null!), Is.Null);
Assert.False(CrontabSchedule.TryParse(null, out var _));
Assert.False(CrontabSchedule.TryParse(string.Empty, out var _));
}

[Test]
Expand Down
6 changes: 4 additions & 2 deletions NCrontab/CrontabSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ public static CrontabSchedule Parse(string expression, ParseOptions? options) =>

public static CrontabSchedule? TryParse(string expression) => TryParse(expression, null);

public static bool TryParse(string expression, out CrontabSchedule schedule) => (schedule = TryParse(expression, null))!=null;
public static bool TryParse(string expression, out CrontabSchedule? schedule)
=> (schedule = TryParse(expression, null))!=null;

public static bool TryParse(string expression, ParseOptions options, out CrontabSchedule schedule) => (schedule = TryParse(expression, options)) != null;
public static bool TryParse(string expression, ParseOptions options, out CrontabSchedule? schedule)
=> (schedule = TryParse(expression, options)) != null;

public static CrontabSchedule? TryParse(string expression, ParseOptions? options) =>
TryParse(expression ?? string.Empty, options, v => v, _ => (CrontabSchedule?)null);
Expand Down
2 changes: 2 additions & 0 deletions NCrontab/PublicAPI/net35/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ static NCrontab.CrontabSchedule.TryParse(string! expression) -> NCrontab.Crontab
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions? options) -> NCrontab.CrontabSchedule?
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, NCrontab.CrontabSchedule.ParseOptions? options, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions! options, out NCrontab.CrontabSchedule? schedule) -> bool
static NCrontab.CrontabSchedule.TryParse(string! expression, out NCrontab.CrontabSchedule? schedule) -> bool
2 changes: 2 additions & 0 deletions NCrontab/PublicAPI/netstandard1.0/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ static NCrontab.CrontabSchedule.TryParse(string! expression) -> NCrontab.Crontab
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions? options) -> NCrontab.CrontabSchedule?
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, NCrontab.CrontabSchedule.ParseOptions? options, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions! options, out NCrontab.CrontabSchedule? schedule) -> bool
static NCrontab.CrontabSchedule.TryParse(string! expression, out NCrontab.CrontabSchedule? schedule) -> bool
2 changes: 2 additions & 0 deletions NCrontab/PublicAPI/netstandard2.0/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ static NCrontab.CrontabSchedule.TryParse(string! expression) -> NCrontab.Crontab
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions? options) -> NCrontab.CrontabSchedule?
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, NCrontab.CrontabSchedule.ParseOptions? options, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse<T>(string! expression, System.Func<NCrontab.CrontabSchedule!, T>! valueSelector, System.Func<NCrontab.ExceptionProvider!, T>! errorSelector) -> T
static NCrontab.CrontabSchedule.TryParse(string! expression, NCrontab.CrontabSchedule.ParseOptions! options, out NCrontab.CrontabSchedule? schedule) -> bool
static NCrontab.CrontabSchedule.TryParse(string! expression, out NCrontab.CrontabSchedule? schedule) -> bool

0 comments on commit 034bec1

Please sign in to comment.