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
use super::*;
/// The Summarizer class.
/// [`Summarizer`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct Summarizer {
inner: Any,
}
impl FromVal for Summarizer {
fn from_val(v: &Any) -> Self {
Summarizer {
inner: Any::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for Summarizer {
type Target = Any;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for Summarizer {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for Summarizer {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for Summarizer {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<Summarizer> for Any {
fn from(s: Summarizer) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&Summarizer> for Any {
fn from(s: &Summarizer) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(Summarizer);
impl Summarizer {
/// Getter of the `sharedContext` attribute.
/// [`Summarizer.sharedContext`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/sharedContext)
pub fn shared_context(&self) -> JsString {
self.inner.get("sharedContext").as_::<JsString>()
}
}
impl Summarizer {
/// Getter of the `type` attribute.
/// [`Summarizer.type`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/type)
pub fn type_(&self) -> SummarizerType {
self.inner.get("type").as_::<SummarizerType>()
}
}
impl Summarizer {
/// Getter of the `format` attribute.
/// [`Summarizer.format`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/format)
pub fn format(&self) -> SummarizerFormat {
self.inner.get("format").as_::<SummarizerFormat>()
}
}
impl Summarizer {
/// Getter of the `length` attribute.
/// [`Summarizer.length`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/length)
pub fn length(&self) -> SummarizerLength {
self.inner.get("length").as_::<SummarizerLength>()
}
}
impl Summarizer {
/// Getter of the `expectedInputLanguages` attribute.
/// [`Summarizer.expectedInputLanguages`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/expectedInputLanguages)
pub fn expected_input_languages(&self) -> TypedArray<JsString> {
self.inner
.get("expectedInputLanguages")
.as_::<TypedArray<JsString>>()
}
}
impl Summarizer {
/// Getter of the `expectedContextLanguages` attribute.
/// [`Summarizer.expectedContextLanguages`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/expectedContextLanguages)
pub fn expected_context_languages(&self) -> TypedArray<JsString> {
self.inner
.get("expectedContextLanguages")
.as_::<TypedArray<JsString>>()
}
}
impl Summarizer {
/// Getter of the `outputLanguage` attribute.
/// [`Summarizer.outputLanguage`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/outputLanguage)
pub fn output_language(&self) -> JsString {
self.inner.get("outputLanguage").as_::<JsString>()
}
}
impl Summarizer {
/// Getter of the `inputQuota` attribute.
/// [`Summarizer.inputQuota`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/inputQuota)
pub fn input_quota(&self) -> f64 {
self.inner.get("inputQuota").as_::<f64>()
}
}
impl Summarizer {
/// The create method.
/// [`Summarizer.create`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/create)
pub fn create() -> Promise<Summarizer> {
Any::global("Summarizer")
.call("create", &[])
.as_::<Promise<Summarizer>>()
}
}
impl Summarizer {
/// The create method.
/// [`Summarizer.create`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/create)
pub fn create_with_options(options: &SummarizerCreateOptions) -> Promise<Summarizer> {
Any::global("Summarizer")
.call("create", &[options.into()])
.as_::<Promise<Summarizer>>()
}
}
impl Summarizer {
/// The availability method.
/// [`Summarizer.availability`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/availability)
pub fn availability() -> Promise<Availability> {
Any::global("Summarizer")
.call("availability", &[])
.as_::<Promise<Availability>>()
}
}
impl Summarizer {
/// The availability method.
/// [`Summarizer.availability`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/availability)
pub fn availability_with_options(
options: &SummarizerCreateCoreOptions,
) -> Promise<Availability> {
Any::global("Summarizer")
.call("availability", &[options.into()])
.as_::<Promise<Availability>>()
}
}
impl Summarizer {
/// The summarize method.
/// [`Summarizer.summarize`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/summarize)
pub fn summarize(&self, input: &JsString) -> Promise<JsString> {
self.inner
.call("summarize", &[input.into()])
.as_::<Promise<JsString>>()
}
}
impl Summarizer {
/// The summarize method.
/// [`Summarizer.summarize`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/summarize)
pub fn summarize_with_options(
&self,
input: &JsString,
options: &SummarizerSummarizeOptions,
) -> Promise<JsString> {
self.inner
.call("summarize", &[input.into(), options.into()])
.as_::<Promise<JsString>>()
}
}
impl Summarizer {
/// The summarizeStreaming method.
/// [`Summarizer.summarizeStreaming`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/summarizeStreaming)
pub fn summarize_streaming(&self, input: &JsString) -> ReadableStream {
self.inner
.call("summarizeStreaming", &[input.into()])
.as_::<ReadableStream>()
}
}
impl Summarizer {
/// The summarizeStreaming method.
/// [`Summarizer.summarizeStreaming`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/summarizeStreaming)
pub fn summarize_streaming_with_options(
&self,
input: &JsString,
options: &SummarizerSummarizeOptions,
) -> ReadableStream {
self.inner
.call("summarizeStreaming", &[input.into(), options.into()])
.as_::<ReadableStream>()
}
}
impl Summarizer {
/// The measureInputUsage method.
/// [`Summarizer.measureInputUsage`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/measureInputUsage)
pub fn measure_input_usage(&self, input: &JsString) -> Promise<f64> {
self.inner
.call("measureInputUsage", &[input.into()])
.as_::<Promise<f64>>()
}
}
impl Summarizer {
/// The measureInputUsage method.
/// [`Summarizer.measureInputUsage`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/measureInputUsage)
pub fn measure_input_usage_with_options(
&self,
input: &JsString,
options: &SummarizerSummarizeOptions,
) -> Promise<f64> {
self.inner
.call("measureInputUsage", &[input.into(), options.into()])
.as_::<Promise<f64>>()
}
}
impl Summarizer {
/// The destroy method.
/// [`Summarizer.destroy`](https://developer.mozilla.org/en-US/docs/Web/API/Summarizer/destroy)
pub fn destroy(&self) -> Undefined {
self.inner.call("destroy", &[]).as_::<Undefined>()
}
}