Skip to content

Commit

Permalink
Remove SerializeNotNull (#173)
Browse files Browse the repository at this point in the history
Redundant with just calling Serialize on the value.
  • Loading branch information
agocke authored Jul 1, 2024
1 parent 0e67e04 commit eb804f4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
3 changes: 0 additions & 3 deletions src/serde-xml/XmlSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ public void SerializeI64(long i64)
}
}

void ISerializer.SerializeNotNull<T, U>(T t, U u)
=> u.Serialize(t, this);

public void SerializeNull()
{
// Default behavior is to skip serialization of null values
Expand Down
3 changes: 0 additions & 3 deletions src/serde/ISerialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ public interface ISerializer
void SerializeDecimal(decimal d);
void SerializeString(string s);
void SerializeNull();
void SerializeNotNull<T, U>(T t, U u)
where T : notnull
where U : ISerialize<T>;
void SerializeEnumValue<T, U>(string enumName, string? valueName, T value, U serialize)
where T : unmanaged
where U : ISerialize<T>;
Expand Down
2 changes: 1 addition & 1 deletion src/serde/Wrappers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ public readonly partial record struct SerializeImpl<T, TWrap>(T? Value) : ISeria
}
else
{
serializer.SerializeNotNull(value, default(TWrap));
default(TWrap).Serialize(value, serializer);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/serde/json/JsonSerializerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ void ISerializer.SerializeEnumValue<T, U>(string enumName, string? valueName, T
public ISerializeCollection SerializeCollection(TypeInfo typeInfo, int? length) => throw new KeyNotStringException();
public ISerializeType SerializeType(TypeInfo typeInfo) => throw new KeyNotStringException();
public void SerializeNull() => throw new KeyNotStringException();
void ISerializer.SerializeNotNull<T, U>(T t, U u) => throw new KeyNotStringException();
}
}

Expand Down

0 comments on commit eb804f4

Please sign in to comment.