Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2b00034

Browse files
committedJul 6, 2015
Fix doc comment syntax
1 parent a6d1eff commit 2b00034

File tree

3 files changed

+83
-79
lines changed

3 files changed

+83
-79
lines changed
 

‎docs/Node/Buffer.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,25 @@
66
type Octet = Int
77
```
88

9+
Type synonym indicating the value should be an octet (0-255). If the value
10+
provided is outside this range it will be used as modulo 255.
11+
912
#### `Offset`
1013

1114
``` purescript
1215
type Offset = Int
1316
```
1417

18+
Type synonym indicating the value refers to an offset in a buffer.
19+
1520
#### `Buffer`
1621

1722
``` purescript
1823
data Buffer :: *
1924
```
2025

26+
An instance of Node's Buffer class.
27+
2128
##### Instances
2229
``` purescript
2330
instance showBuffer :: Show Buffer
@@ -29,6 +36,8 @@ instance showBuffer :: Show Buffer
2936
data BufferWrite :: !
3037
```
3138

39+
Effect for buffer modification.
40+
3241
#### `BufferValueType`
3342

3443
``` purescript
@@ -49,6 +58,8 @@ data BufferValueType
4958
| DoubleBE
5059
```
5160

61+
Enumeration of the numeric types that can be written to a buffer.
62+
5263
##### Instances
5364
``` purescript
5465
instance showBufferValueType :: Show BufferValueType
@@ -60,94 +71,131 @@ instance showBufferValueType :: Show BufferValueType
6071
create :: Int -> Buffer
6172
```
6273

74+
Creates a new buffer of the specified size.
75+
6376
#### `fromArray`
6477

6578
``` purescript
6679
fromArray :: Array Octet -> Buffer
6780
```
6881

82+
Creates a new buffer from an array of octets, sized to match the array.
83+
6984
#### `fromString`
7085

7186
``` purescript
7287
fromString :: String -> Encoding -> Buffer
7388
```
7489

90+
Creates a new buffer from a string with the specified encoding, sized to
91+
match the string.
92+
7593
#### `read`
7694

7795
``` purescript
7896
read :: BufferValueType -> Offset -> Buffer -> Int
7997
```
8098

99+
Reads a numeric value from a buffer at the specified offset.
100+
81101
#### `readString`
82102

83103
``` purescript
84104
readString :: Encoding -> Offset -> Offset -> Buffer -> String
85105
```
86106

107+
Reads a section of a buffer as a string with the specified encoding.
108+
87109
#### `toString`
88110

89111
``` purescript
90112
toString :: Encoding -> Buffer -> String
91113
```
92114

115+
Reads the buffer as a string with the specified encoding.
116+
93117
#### `write`
94118

95119
``` purescript
96120
write :: forall e. BufferValueType -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
97121
```
98122

123+
Writes a numeric value to a buffer at the specified offset.
124+
99125
#### `writeString`
100126

101127
``` purescript
102128
writeString :: forall e. Encoding -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
103129
```
104130

131+
Writes octets from a string to a buffer at the specified offset. Multi-byte
132+
characters will not be written to the buffer if there is not enough capacity
133+
to write them fully. The number of bytes written is returned.
134+
105135
#### `toArray`
106136

107137
``` purescript
108138
toArray :: Buffer -> Array Octet
109139
```
110140

141+
Creates an array of octets from a buffer's contents.
142+
111143
#### `getAtOffset`
112144

113145
``` purescript
114146
getAtOffset :: Offset -> Buffer -> Maybe Octet
115147
```
116148

149+
Reads an octet from a buffer at the specified offset.
150+
117151
#### `setAtOffset`
118152

119153
``` purescript
120154
setAtOffset :: forall e. Octet -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
121155
```
122156

157+
Writes an octet in the buffer at the specified offset.
158+
123159
#### `size`
124160

125161
``` purescript
126162
size :: Buffer -> Int
127163
```
128164

165+
Returns the size of a buffer.
166+
129167
#### `concat`
130168

131169
``` purescript
132170
concat :: Array Buffer -> Buffer
133171
```
134172

173+
Concatenates a list of buffers.
174+
135175
#### `concat'`
136176

137177
``` purescript
138178
concat' :: Array Buffer -> Int -> Buffer
139179
```
140180

181+
Concatenates a list of buffers, combining them into a new buffer of the
182+
specified length.
183+
141184
#### `copy`
142185

143186
``` purescript
144187
copy :: Offset -> Offset -> Buffer -> Offset -> Buffer -> Buffer
145188
```
146189

190+
Copies a section of a source buffer into a target buffer at the specified
191+
offset.
192+
147193
#### `fill`
148194

149195
``` purescript
150196
fill :: forall e. Octet -> Offset -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
151197
```
152198

199+
Fills a range in a buffer with the specified octet.
200+
153201

‎src/Node/Buffer.purs

Lines changed: 31 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,25 @@ import Control.Monad.Eff
2727
import Data.Maybe
2828
import Node.Encoding
2929

30-
-- |
31-
-- Type synonym indicating the value should be an octet (0-255). If the value
32-
-- provided is outside this range it will be used as modulo 255.
33-
--
30+
-- | Type synonym indicating the value should be an octet (0-255). If the value
31+
-- | provided is outside this range it will be used as modulo 255.
3432
type Octet = Int
3533

36-
-- |
37-
-- Type synonym indicating the value refers to an offset in a buffer.
38-
--
34+
-- | Type synonym indicating the value refers to an offset in a buffer.
3935
type Offset = Int
4036

41-
-- |
42-
-- An instance of Node's Buffer class.
43-
--
37+
-- | An instance of Node's Buffer class.
4438
foreign import data Buffer :: *
4539

4640
instance showBuffer :: Show Buffer where
4741
show = showImpl
48-
42+
4943
foreign import showImpl :: Buffer -> String
5044

51-
-- |
52-
-- Effect for buffer modification.
53-
--
45+
-- | Effect for buffer modification.
5446
foreign import data BufferWrite :: !
5547

56-
-- |
57-
-- Enumeration of the numeric types that can be written to a buffer.
58-
--
48+
-- | Enumeration of the numeric types that can be written to a buffer.
5949
data BufferValueType
6050
= UInt8
6151
| UInt16LE
@@ -88,113 +78,81 @@ instance showBufferValueType :: Show BufferValueType where
8878
show DoubleLE = "DoubleLE"
8979
show DoubleBE = "DoubleBE"
9080

91-
-- |
92-
-- Creates a new buffer of the specified size.
93-
--
81+
-- | Creates a new buffer of the specified size.
9482
foreign import create :: Int -> Buffer
9583

96-
-- |
97-
-- Creates a new buffer from an array of octets, sized to match the array.
98-
--
84+
-- | Creates a new buffer from an array of octets, sized to match the array.
9985
foreign import fromArray :: Array Octet -> Buffer
10086

101-
-- |
102-
-- Creates a new buffer from a string with the specified encoding, sized to
103-
-- match the string.
104-
--
87+
-- | Creates a new buffer from a string with the specified encoding, sized to
88+
-- | match the string.
10589
fromString :: String -> Encoding -> Buffer
10690
fromString str = fromStringImpl str <<< show
10791

10892
foreign import fromStringImpl :: String -> String -> Buffer
10993

110-
-- |
111-
-- Reads a numeric value from a buffer at the specified offset.
112-
--
94+
-- | Reads a numeric value from a buffer at the specified offset.
11395
read :: BufferValueType -> Offset -> Buffer -> Int
11496
read = readImpl <<< show
11597

11698
foreign import readImpl :: String -> Offset -> Buffer -> Int
11799

118-
-- |
119-
-- Reads a section of a buffer as a string with the specified encoding.
120-
--
100+
-- | Reads a section of a buffer as a string with the specified encoding.
121101
readString :: Encoding -> Offset -> Offset -> Buffer -> String
122102
readString = readStringImpl <<< show
123103

124104
foreign import readStringImpl :: String -> Offset -> Offset -> Buffer -> String
125-
126-
-- |
127-
-- Reads the buffer as a string with the specified encoding.
128-
--
105+
106+
-- | Reads the buffer as a string with the specified encoding.
129107
toString :: Encoding -> Buffer -> String
130108
toString = toStringImpl <<< show
131109

132110
foreign import toStringImpl :: String -> Buffer -> String
133111

134-
-- |
135-
-- Writes a numeric value to a buffer at the specified offset.
136-
--
112+
-- | Writes a numeric value to a buffer at the specified offset.
137113
write :: forall e. BufferValueType -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
138114
write = writeImpl <<< show
139115

140116
foreign import writeImpl ::
141117
forall e. String -> Int -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
142118

143-
-- |
144-
-- Writes octets from a string to a buffer at the specified offset. Multi-byte
145-
-- characters will not be written to the buffer if there is not enough capacity
146-
-- to write them fully. The number of bytes written is returned.
147-
--
119+
-- | Writes octets from a string to a buffer at the specified offset. Multi-byte
120+
-- | characters will not be written to the buffer if there is not enough capacity
121+
-- | to write them fully. The number of bytes written is returned.
148122
writeString :: forall e. Encoding -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
149123
writeString = writeStringImpl <<< show
150124

151125
foreign import writeStringImpl ::
152126
forall e. String -> Offset -> Int -> String -> Buffer -> Eff (buffer :: BufferWrite | e) Int
153127

154-
-- |
155-
-- Creates an array of octets from a buffer's contents.
156-
--
128+
-- | Creates an array of octets from a buffer's contents.
157129
foreign import toArray :: Buffer -> Array Octet
158130

159-
-- |
160-
-- Reads an octet from a buffer at the specified offset.
161-
--
131+
-- | Reads an octet from a buffer at the specified offset.
162132
getAtOffset :: Offset -> Buffer -> Maybe Octet
163133
getAtOffset = getAtOffsetImpl Just Nothing
164134

165135
foreign import getAtOffsetImpl ::
166136
(Octet -> Maybe Octet) -> Maybe Octet -> Offset -> Buffer -> Maybe Octet
167137

168-
-- |
169-
-- Writes an octet in the buffer at the specified offset.
170-
--
138+
-- | Writes an octet in the buffer at the specified offset.
171139
foreign import setAtOffset ::
172140
forall e. Octet -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit
173141

174-
-- |
175-
-- Returns the size of a buffer.
176-
--
142+
-- | Returns the size of a buffer.
177143
foreign import size :: Buffer -> Int
178144

179-
-- |
180-
-- Concatenates a list of buffers.
181-
--
145+
-- | Concatenates a list of buffers.
182146
foreign import concat :: Array Buffer -> Buffer
183-
184-
-- |
185-
-- Concatenates a list of buffers, combining them into a new buffer of the
186-
-- specified length.
187-
--
147+
148+
-- | Concatenates a list of buffers, combining them into a new buffer of the
149+
-- | specified length.
188150
foreign import concat' :: Array Buffer -> Int -> Buffer
189151

190-
-- |
191-
-- Copies a section of a source buffer into a target buffer at the specified
192-
-- offset.
193-
--
152+
-- | Copies a section of a source buffer into a target buffer at the specified
153+
-- | offset.
194154
foreign import copy :: Offset -> Offset -> Buffer -> Offset -> Buffer -> Buffer
195-
196-
-- |
197-
-- Fills a range in a buffer with the specified octet.
198-
--
155+
156+
-- | Fills a range in a buffer with the specified octet.
199157
foreign import fill ::
200158
forall e. Octet -> Offset -> Offset -> Buffer -> Eff (buffer :: BufferWrite | e) Unit

‎src/Node/Buffer/Unsafe.purs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ module Node.Buffer.Unsafe where
22

33
import Node.Buffer
44

5-
-- |
6-
-- Creates a new buffer slice that acts like a window on the original buffer.
7-
-- Writing to the slice buffer updates the original buffer and vice-versa.
8-
--
9-
-- This is considered unsafe as writing to a slice can result in action at a
10-
-- distance.
5+
-- | Creates a new buffer slice that acts like a window on the original buffer.
6+
-- | Writing to the slice buffer updates the original buffer and vice-versa.
117
--
8+
-- | This is considered unsafe as writing to a slice can result in action at a
9+
-- | distance.
1210
foreign import slice :: Offset -> Offset -> Buffer -> Buffer

0 commit comments

Comments
 (0)
Please sign in to comment.