Skip to content

Commit

Permalink
Use ref structs for iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
odinserj committed Jun 20, 2024
1 parent 0c9e2ac commit efa8712
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Hangfire.Core/Common/JobFilterInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public readonly struct FilterCollection<T>(List<JobFilter> filters)
{
public Enumerator GetEnumerator() => new Enumerator(filters);

public struct Enumerator(List<JobFilter> filters)
public ref struct Enumerator(List<JobFilter> filters)
{
private readonly List<JobFilter> _filters = filters;
private int _index = 0;
Expand Down Expand Up @@ -136,7 +136,7 @@ public readonly struct ReversedFilterCollection<T>(List<JobFilter> filters)
{
public ReversedEnumerator GetEnumerator() => new ReversedEnumerator(filters);

public struct ReversedEnumerator(List<JobFilter> filters)
public ref struct ReversedEnumerator(List<JobFilter> filters)
{
private readonly List<JobFilter> _filters = filters;
private int _index = filters.Count - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/Hangfire.Core/States/CoreStateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal readonly struct StateHandlersCollection(
{
public Enumerator GetEnumerator() => new Enumerator(globalHandlers, storageHandlers, stateName);

public struct Enumerator
public ref struct Enumerator
{
private readonly IEnumerator<IStateHandler> _globalEnumerator;
private readonly IEnumerator<IStateHandler> _storageEnumerator;
Expand Down

0 comments on commit efa8712

Please sign in to comment.