Files
SpacetimeDB/crates/bindings-csharp/Codegen.Tests/fixtures/server/snapshots/Module#Timers.SendMessageTimer.verified.cs
james gilles 0d2a45b239 Fix fields named 'read' (#2525)
# Description of Changes

Fixes
https://github.com/orgs/clockworklabs/projects/22?pane=issue&itemId=102392974&issue=clockworklabs%7Ccom.clockworklabs.spacetimedbsdk%7C276

by renaming `internal` `static` serializer fields so that they do not
overlap with user-provided names.

Note, however, that some field names still will not work: `ReadFields`,
`WriteFields`, `Equals`, and `GetHashCode`.
This would require a separate fix since the error would happen in a
different place. In this case we would need to change the name of the
generated member to something like `ReadFields_` or `Equals_`, which I'm
not sure is a good idea.

# API and ABI breaking changes

N/A

# Expected complexity level and risk

0

# Testing

SDK tests and `dotnet-verify` tests are passing.

---------

Signed-off-by: rekhoff <r.ekhoff@clockworklabs.io>
Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io>
2025-08-26 21:17:46 +00:00

124 lines
4.7 KiB
C#

//HintName: Timers.SendMessageTimer.cs
// <auto-generated />
#nullable enable
partial class Timers
{
partial struct SendMessageTimer
: System.IEquatable<SendMessageTimer>,
SpacetimeDB.BSATN.IStructuralReadWrite
{
public void ReadFields(System.IO.BinaryReader reader)
{
ScheduledId = BSATN.ScheduledIdRW.Read(reader);
ScheduledAt = BSATN.ScheduledAtRW.Read(reader);
Text = BSATN.TextRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.ScheduledIdRW.Write(writer, ScheduledId);
BSATN.ScheduledAtRW.Write(writer, ScheduledAt);
BSATN.TextRW.Write(writer, Text);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
{
return new BSATN();
}
public override string ToString() =>
$"SendMessageTimer {{ ScheduledId = {SpacetimeDB.BSATN.StringUtil.GenericToString(ScheduledId)}, ScheduledAt = {SpacetimeDB.BSATN.StringUtil.GenericToString(ScheduledAt)}, Text = {SpacetimeDB.BSATN.StringUtil.GenericToString(Text)} }}";
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<Timers.SendMessageTimer>
{
internal static readonly SpacetimeDB.BSATN.U64 ScheduledIdRW = new();
internal static readonly SpacetimeDB.ScheduleAt.BSATN ScheduledAtRW = new();
internal static readonly SpacetimeDB.BSATN.String TextRW = new();
public Timers.SendMessageTimer Read(System.IO.BinaryReader reader)
{
var ___result = new Timers.SendMessageTimer();
___result.ReadFields(reader);
return ___result;
}
public void Write(System.IO.BinaryWriter writer, Timers.SendMessageTimer value)
{
value.WriteFields(writer);
}
public SpacetimeDB.BSATN.AlgebraicType.Ref GetAlgebraicType(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
registrar.RegisterType<Timers.SendMessageTimer>(
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new("ScheduledId", ScheduledIdRW.GetAlgebraicType(registrar)),
new("ScheduledAt", ScheduledAtRW.GetAlgebraicType(registrar)),
new("Text", TextRW.GetAlgebraicType(registrar))
}
)
);
SpacetimeDB.BSATN.AlgebraicType SpacetimeDB.BSATN.IReadWrite<Timers.SendMessageTimer>.GetAlgebraicType(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) => GetAlgebraicType(registrar);
}
public override int GetHashCode()
{
var ___hashScheduledId = ScheduledId.GetHashCode();
var ___hashScheduledAt = ScheduledAt == null ? 0 : ScheduledAt.GetHashCode();
var ___hashText = Text == null ? 0 : Text.GetHashCode();
return ___hashScheduledId ^ ___hashScheduledAt ^ ___hashText;
}
#nullable enable
public bool Equals(Timers.SendMessageTimer that)
{
var ___eqScheduledId = this.ScheduledId.Equals(that.ScheduledId);
var ___eqScheduledAt =
this.ScheduledAt == null
? that.ScheduledAt == null
: this.ScheduledAt.Equals(that.ScheduledAt);
var ___eqText = this.Text == null ? that.Text == null : this.Text.Equals(that.Text);
return ___eqScheduledId && ___eqScheduledAt && ___eqText;
}
public override bool Equals(object? that)
{
if (that == null)
{
return false;
}
var that_ = that as Timers.SendMessageTimer?;
if (((object?)that_) == null)
{
return false;
}
return Equals(that_);
}
public static bool operator ==(Timers.SendMessageTimer this_, Timers.SendMessageTimer that)
{
if (((object?)this_) == null || ((object?)that) == null)
{
return object.Equals(this_, that);
}
return this_.Equals(that);
}
public static bool operator !=(Timers.SendMessageTimer this_, Timers.SendMessageTimer that)
{
if (((object?)this_) == null || ((object?)that) == null)
{
return !object.Equals(this_, that);
}
return !this_.Equals(that);
}
#nullable restore
} // SendMessageTimer
} // Timers