pleroma: nullable implicit conversions
This commit is contained in:
parent
6868b6a465
commit
eff187f064
2 changed files with 8 additions and 0 deletions
|
@ -71,8 +71,12 @@ public readonly struct AccountID(string id)
|
|||
{
|
||||
public static implicit operator AccountID(string id) => new AccountID(id);
|
||||
|
||||
public static implicit operator AccountID?(string? id) => id == null ? new AccountID?() : new AccountID(id);
|
||||
|
||||
public static implicit operator AccountID(Account account) => new AccountID(account.ID);
|
||||
|
||||
public static implicit operator AccountID?(Account? account) => account == null ? new AccountID?() : new AccountID(account.ID);
|
||||
|
||||
public static implicit operator AccountID(Relationship relationship) => new AccountID(relationship.ID);
|
||||
|
||||
public readonly string ID = id;
|
||||
|
|
|
@ -222,8 +222,12 @@ public readonly struct StatusID(string id) : IEquatable<StatusID>
|
|||
{
|
||||
public static implicit operator StatusID(string id) => new StatusID(id);
|
||||
|
||||
public static implicit operator StatusID?(string? id) => id == null ? new StatusID?() : new StatusID(id);
|
||||
|
||||
public static implicit operator StatusID(Status status) => new StatusID(status.ID);
|
||||
|
||||
public static implicit operator StatusID?(Status? status) => status == null ? new StatusID?() : new StatusID(status.ID);
|
||||
|
||||
public readonly string ID = id;
|
||||
|
||||
public override string ToString() => ID;
|
||||
|
|
Loading…
Reference in a new issue