summaryrefslogtreecommitdiffstats
path: root/intl/icu_capi/js/package/docs/source/fixed_decimal_ffi.rst
blob: 354705dc5cca0cd1dcdda46364a75231e21987f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
``fixed_decimal::ffi``
======================

.. js:class:: ICU4XFixedDecimal

    See the `Rust documentation for FixedDecimal <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html>`__ for more information.


    .. js:function:: create_from_i32(v)

        Construct an :js:class:`ICU4XFixedDecimal` from an integer.

        See the `Rust documentation for FixedDecimal <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html>`__ for more information.


    .. js:function:: create_from_u32(v)

        Construct an :js:class:`ICU4XFixedDecimal` from an integer.

        See the `Rust documentation for FixedDecimal <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html>`__ for more information.


    .. js:function:: create_from_i64(v)

        Construct an :js:class:`ICU4XFixedDecimal` from an integer.

        See the `Rust documentation for FixedDecimal <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html>`__ for more information.


    .. js:function:: create_from_u64(v)

        Construct an :js:class:`ICU4XFixedDecimal` from an integer.

        See the `Rust documentation for FixedDecimal <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html>`__ for more information.


    .. js:function:: create_from_f64_with_integer_precision(f)

        Construct an :js:class:`ICU4XFixedDecimal` from an integer-valued float

        See the `Rust documentation for try_from_f64 <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64>`__ for more information.

        See the `Rust documentation for FloatPrecision <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html>`__ for more information.


    .. js:function:: create_from_f64_with_lower_magnitude(f, magnitude)

        Construct an :js:class:`ICU4XFixedDecimal` from an float, with a given power of 10 for the lower magnitude

        See the `Rust documentation for try_from_f64 <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64>`__ for more information.

        See the `Rust documentation for FloatPrecision <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html>`__ for more information.


    .. js:function:: create_from_f64_with_significant_digits(f, digits)

        Construct an :js:class:`ICU4XFixedDecimal` from an float, for a given number of significant digits

        See the `Rust documentation for try_from_f64 <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64>`__ for more information.

        See the `Rust documentation for FloatPrecision <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html>`__ for more information.


    .. js:function:: create_from_f64_with_floating_precision(f)

        Construct an :js:class:`ICU4XFixedDecimal` from an float, with enough digits to recover the original floating point in IEEE 754 without needing trailing zeros

        See the `Rust documentation for try_from_f64 <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.try_from_f64>`__ for more information.

        See the `Rust documentation for FloatPrecision <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.FloatPrecision.html>`__ for more information.


    .. js:function:: create_from_string(v)

        Construct an :js:class:`ICU4XFixedDecimal` from a string.

        See the `Rust documentation for from_str <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.from_str>`__ for more information.


    .. js:method:: digit_at(magnitude)

        See the `Rust documentation for digit_at <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.digit_at>`__ for more information.


    .. js:method:: magnitude_start()

        See the `Rust documentation for magnitude_range <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range>`__ for more information.


    .. js:method:: magnitude_end()

        See the `Rust documentation for magnitude_range <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.magnitude_range>`__ for more information.


    .. js:method:: nonzero_magnitude_start()

        See the `Rust documentation for nonzero_magnitude_start <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_start>`__ for more information.


    .. js:method:: nonzero_magnitude_end()

        See the `Rust documentation for nonzero_magnitude_end <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.nonzero_magnitude_end>`__ for more information.


    .. js:method:: is_zero()

        See the `Rust documentation for is_zero <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.is_zero>`__ for more information.


    .. js:method:: multiply_pow10(power)

        Multiply the :js:class:`ICU4XFixedDecimal` by a given power of ten.

        See the `Rust documentation for multiply_pow10 <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.multiply_pow10>`__ for more information.


    .. js:method:: sign()

        See the `Rust documentation for sign <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.sign>`__ for more information.


    .. js:method:: set_sign(sign)

        Set the sign of the :js:class:`ICU4XFixedDecimal`.

        See the `Rust documentation for set_sign <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_sign>`__ for more information.


    .. js:method:: apply_sign_display(sign_display)

        See the `Rust documentation for apply_sign_display <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.apply_sign_display>`__ for more information.


    .. js:method:: trim_start()

        See the `Rust documentation for trim_start <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_start>`__ for more information.


    .. js:method:: trim_end()

        See the `Rust documentation for trim_end <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trim_end>`__ for more information.


    .. js:method:: pad_start(position)

        Zero-pad the :js:class:`ICU4XFixedDecimal` on the left to a particular position

        See the `Rust documentation for pad_start <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_start>`__ for more information.


    .. js:method:: pad_end(position)

        Zero-pad the :js:class:`ICU4XFixedDecimal` on the right to a particular position

        See the `Rust documentation for pad_end <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.pad_end>`__ for more information.


    .. js:method:: set_max_position(position)

        Truncate the :js:class:`ICU4XFixedDecimal` on the left to a particular position, deleting digits if necessary. This is useful for, e.g. abbreviating years ("2022" -> "22")

        See the `Rust documentation for set_max_position <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.set_max_position>`__ for more information.


    .. js:method:: trunc(position)

        See the `Rust documentation for trunc <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.trunc>`__ for more information.


    .. js:method:: half_trunc(position)

        See the `Rust documentation for half_trunc <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_trunc>`__ for more information.


    .. js:method:: expand(position)

        See the `Rust documentation for expand <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.expand>`__ for more information.


    .. js:method:: half_expand(position)

        See the `Rust documentation for half_expand <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_expand>`__ for more information.


    .. js:method:: ceil(position)

        See the `Rust documentation for ceil <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.ceil>`__ for more information.


    .. js:method:: half_ceil(position)

        See the `Rust documentation for half_ceil <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_ceil>`__ for more information.


    .. js:method:: floor(position)

        See the `Rust documentation for floor <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.floor>`__ for more information.


    .. js:method:: half_floor(position)

        See the `Rust documentation for half_floor <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_floor>`__ for more information.


    .. js:method:: half_even(position)

        See the `Rust documentation for half_even <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.half_even>`__ for more information.


    .. js:method:: concatenate_end(other)

        Concatenates ``other`` to the end of ``self``.

        If successful, ``other`` will be set to 0 and a successful status is returned.

        If not successful, ``other`` will be unchanged and an error is returned.

        See the `Rust documentation for concatenate_end <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.concatenate_end>`__ for more information.


    .. js:method:: to_string()

        Format the :js:class:`ICU4XFixedDecimal` as a string.

        See the `Rust documentation for write_to <https://docs.rs/fixed_decimal/latest/fixed_decimal/struct.FixedDecimal.html#method.write_to>`__ for more information.


.. js:class:: ICU4XFixedDecimalSign

    The sign of a FixedDecimal, as shown in formatting.

    See the `Rust documentation for Sign <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.Sign.html>`__ for more information.


.. js:class:: ICU4XFixedDecimalSignDisplay

    ECMA-402 compatible sign display preference.

    See the `Rust documentation for SignDisplay <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.SignDisplay.html>`__ for more information.


.. js:class:: ICU4XRoundingIncrement

    Increment used in a rounding operation.

    See the `Rust documentation for RoundingIncrement <https://docs.rs/fixed_decimal/latest/fixed_decimal/enum.RoundingIncrement.html>`__ for more information.