Skip to content

Commit 05fc7de

Browse files
ahsonkhanBillWagner
authored andcommitted
Update the IBufferWriter contract definition doc to be clearer (#1949)
* Update the IBufferWriter contract definition doc to be clearer See dotnet/corefx#35554 for changes to the source. Please review if the formatting and style/tone is appropriate. cc @mairaw * Eliminated duplicate remarks tags. * Attempting to address build error * Eliminated duplicate tags.
1 parent b7894f3 commit 05fc7de

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

xml/System.Buffers/IBufferWriter`1.xml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<Interfaces />
1818
<Docs>
1919
<typeparam name="T">The type of the items in the <see cref="T:System.Buffers.IBufferWriter`1" />.</typeparam>
20-
<summary>Represents a <typeparamref name="T" /> sink.</summary>
20+
<summary>Represents a <typeparamref name="T" /> output sink into which data can be written.</summary>
2121
<remarks>To be added.</remarks>
2222
</Docs>
2323
<Members>
@@ -43,8 +43,8 @@
4343
</Parameters>
4444
<Docs>
4545
<param name="count">The number of data items written to the <see cref="T:System.Span`1" /> or <see cref="T:System.Memory`1" />.</param>
46-
<summary>Notifies the <see cref="T:System.Buffers.IBufferWriter`1" /> that <paramref name="count" /> data items were written to the <see cref="T:System.Span`1" /> or <see cref="T:System.Memory`1" />.</summary>
47-
<remarks>To be added.</remarks>
46+
<summary>Notifies the <see cref="T:System.Buffers.IBufferWriter`1" /> that <paramref name="count" /> data items were written to the output <see cref="T:System.Span`1" /> or <see cref="T:System.Memory`1" />.</summary>
47+
<remarks>You must request a new buffer after calling Advance to continue writing more data; you cannot write to a previously acquired buffer.</remarks>
4848
</Docs>
4949
</Member>
5050
<Member MemberName="GetMemory">
@@ -67,10 +67,21 @@
6767
<Parameter Name="sizeHint" Type="System.Int32" />
6868
</Parameters>
6969
<Docs>
70-
<param name="sizeHint">The size of the <see cref="T:System.Memory`1" /> requested. If 0, requests currently available memory. </param>
71-
<summary>Requests a <see cref="T:System.Memory`1" /> that is at least <paramref name="sizeHint" /> in size if possible.</summary>
72-
<returns>A <see cref="T:System.Memory`1" /> of size <paramref name="sizeHint" />, if it's available; otherwise, a <see cref="T:System.Memory`1" /> with the maximum available memory. If <paramref name="sizeHint" /> is 0, returns currently available memory.</returns>
73-
<remarks>To be added.</remarks>
70+
<param name="sizeHint">The minimum length of the returned <see cref="T:System.Memory`1" />. If 0, some, non-empty buffer is returned. </param>
71+
<summary>Returns a <see cref="T:System.Memory`1" /> to write to that is at least the requested size (specified by <paramref name="sizeHint" />).</summary>
72+
<returns>A <see cref="T:System.Memory`1" /> of at least the size <paramref name="sizeHint" />. If <paramref name="sizeHint" /> is 0, returns a non-empty buffer.</returns>
73+
<remarks>
74+
<format type="text/markdown"><![CDATA[
75+
76+
There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
77+
78+
This must never return <xref:System.Span%601.Empty?displayProperty=nameWithType>, but it can throw <xref:System.OutOfMemoryException> if the requested buffer size is not available.
79+
80+
You must request a new buffer after calling `Advance` to continue writing more data; you cannot write to a previously acquired buffer.
81+
82+
]]></format>
83+
</remarks>
84+
<exception cref="T:System.OutOfMemoryException">The requested buffer size is not available.</exception>
7485
</Docs>
7586
</Member>
7687
<Member MemberName="GetSpan">
@@ -93,11 +104,20 @@
93104
<Parameter Name="sizeHint" Type="System.Int32" />
94105
</Parameters>
95106
<Docs>
96-
<param name="sizeHint">The size of the memory span requested. If 0, requests currently available memory. </param>
97-
<summary>Requests a span that is at least <paramref name="sizeHint" /> in size if possible.</summary>
98-
<returns>A span of size <paramref name="sizeHint" />, if it's available; otherwise, a memory span with the maximum available memory. If <paramref name="sizeHint" /> is 0, returns currently available memory.</returns>
99-
<remarks>To be added.</remarks>
107+
<param name="sizeHint">The minimum length of the returned <see cref="T:System.Span`1" />. If 0, some, non-empty buffer is returned. </param>
108+
<summary>Returns a <see cref="T:System.Span`1" /> to write to that is at least the requested size (specified by <paramref name="sizeHint" />).</summary>
109+
<returns>A <see cref="T:System.Span`1" /> of at least the size <paramref name="sizeHint" />. If <paramref name="sizeHint" /> is 0, returns a non-empty buffer.</returns>
110+
<remarks>
111+
<format type="text/markdown"><![CDATA[
112+
113+
There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
114+
115+
This method must never return <xref:System.Span%601.Empty?displayProperty=nameWithType>, but it can throw <xref:System.OutOfMemoryException> if the requested buffer size is not available.
116+
117+
You must request a new buffer after calling `Advance` to continue writing more data; you cannot write to a previously acquired buffer.
118+
]]></format>
119+
</remarks>
100120
</Docs>
101121
</Member>
102122
</Members>
103-
</Type>
123+
</Type>

0 commit comments

Comments
 (0)