-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add queue and stack mapping (#297)
- Loading branch information
1 parent
0cf85b3
commit 5040bf5
Showing
7 changed files
with
184 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...apperly.Tests/_snapshots/EnumerableTest.MapToExistingQueueShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//HintName: Mapper.g.cs | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
private partial void Map(System.Collections.Generic.List<A>? source, System.Collections.Generic.Queue<B> target) | ||
{ | ||
if (source == null) | ||
return; | ||
foreach (var item in source) | ||
{ | ||
target.Enqueue(MapToB(item)); | ||
} | ||
} | ||
|
||
private B MapToB(A source) | ||
{ | ||
var target = new B(); | ||
target.Value = source.Value; | ||
return target; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...apperly.Tests/_snapshots/EnumerableTest.MapToExistingStackShouldWork#Mapper.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//HintName: Mapper.g.cs | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
private partial void Map(System.Collections.Generic.List<A>? source, System.Collections.Generic.Stack<B> target) | ||
{ | ||
if (source == null) | ||
return; | ||
foreach (var item in source) | ||
{ | ||
target.Push(MapToB(item)); | ||
} | ||
} | ||
|
||
private B MapToB(A source) | ||
{ | ||
var target = new B(); | ||
target.Value = source.Value; | ||
return target; | ||
} | ||
} |