• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

davidcole1340 / ext-php-rs / 16880353614

11 Aug 2025 12:42PM UTC coverage: 26.825% (-1.0%) from 27.778%
16880353614

Pull #533

github

web-flow
Merge 9e9410bbe into 896cb945d
Pull Request #533: Feat/interface impl

8 of 179 new or added lines in 9 files covered. (4.47%)

2 existing lines in 2 files now uncovered.

1161 of 4328 relevant lines covered (26.83%)

7.42 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/crates/macros/src/function.rs
1
use std::collections::HashMap;
2

3
use darling::{FromAttributes, ToTokens};
4
use proc_macro2::{Ident, Span, TokenStream};
5
use quote::{format_ident, quote};
6
use syn::spanned::Spanned as _;
7
use syn::{Expr, FnArg, GenericArgument, ItemFn, PatType, PathArguments, Type, TypePath};
8

9
use crate::helpers::get_docs;
10
use crate::parsing::{PhpRename, RenameRule, Visibility};
11
use crate::prelude::*;
12
use crate::syn_ext::DropLifetimes;
13

14
pub fn wrap(input: &syn::Path) -> Result<TokenStream> {
×
15
    let Some(func_name) = input.get_ident() else {
×
16
        bail!(input => "Pass a PHP function name into `wrap_function!()`.");
×
17
    };
18
    let builder_func = format_ident!("_internal_{func_name}");
19

20
    Ok(quote! {{
21
        (<#builder_func as ::ext_php_rs::internal::function::PhpFunction>::FUNCTION_ENTRY)()
22
    }})
23
}
24

25
#[derive(FromAttributes, Default, Debug)]
26
#[darling(default, attributes(php), forward_attrs(doc))]
27
struct PhpFunctionAttribute {
28
    #[darling(flatten)]
29
    rename: PhpRename,
30
    defaults: HashMap<Ident, Expr>,
31
    optional: Option<Ident>,
32
    vis: Option<Visibility>,
33
    attrs: Vec<syn::Attribute>,
34
}
35

36
pub fn parser(mut input: ItemFn) -> Result<TokenStream> {
×
37
    let php_attr = PhpFunctionAttribute::from_attributes(&input.attrs)?;
×
38
    input.attrs.retain(|attr| !attr.path().is_ident("php"));
×
39

40
    let args = Args::parse_from_fnargs(input.sig.inputs.iter(), php_attr.defaults)?;
×
41
    if let Some(ReceiverArg { span, .. }) = args.receiver {
×
42
        bail!(span => "Receiver arguments are invalid on PHP functions. See `#[php_impl]`.");
43
    }
44

45
    let docs = get_docs(&php_attr.attrs)?;
×
46

47
    let func = Function::new(
48
        &input.sig,
49
        php_attr
50
            .rename
51
            .rename(input.sig.ident.to_string(), RenameRule::Snake),
52
        args,
53
        php_attr.optional,
54
        docs,
55
    );
56
    let function_impl = func.php_function_impl();
57

58
    Ok(quote! {
59
        #input
60
        #function_impl
61
    })
62
}
63

64
#[derive(Debug)]
65
pub struct Function<'a> {
66
    /// Identifier of the Rust function associated with the function.
67
    pub ident: &'a Ident,
68
    /// Name of the function in PHP.
69
    pub name: String,
70
    /// Function arguments.
71
    pub args: Args<'a>,
72
    /// Function outputs.
73
    pub output: Option<&'a Type>,
74
    /// The first optional argument of the function.
75
    pub optional: Option<Ident>,
76
    /// Doc comments for the function.
77
    pub docs: Vec<String>,
78
}
79

80
#[derive(Debug)]
81
pub enum CallType<'a> {
82
    Function,
83
    Method {
84
        class: &'a syn::Path,
85
        receiver: MethodReceiver,
86
    },
87
}
88

89
/// Type of receiver on the method.
90
#[derive(Debug)]
91
pub enum MethodReceiver {
92
    /// Static method - has no receiver.
93
    Static,
94
    /// Class method, takes `&self` or `&mut self`.
95
    Class,
96
    /// Class method, takes `&mut ZendClassObject<Self>`.
97
    ZendClassObject,
98
}
99

100
impl<'a> Function<'a> {
101
    /// Parse a function.
102
    ///
103
    /// # Parameters
104
    ///
105
    /// * `sig` - Function signature.
106
    /// * `name` - Function name in PHP land.
107
    /// * `args` - Function arguments.
108
    /// * `optional` - The ident of the first optional argument.
109
    pub fn new(
×
110
        sig: &'a syn::Signature,
111
        name: String,
112
        args: Args<'a>,
113
        optional: Option<Ident>,
114
        docs: Vec<String>,
115
    ) -> Self {
116
        Self {
117
            ident: &sig.ident,
×
118
            name,
119
            args,
120
            output: match &sig.output {
×
121
                syn::ReturnType::Default => None,
122
                syn::ReturnType::Type(_, ty) => Some(&**ty),
123
            },
124
            optional,
125
            docs,
126
        }
127
    }
128

129
    /// Generates an internal identifier for the function.
130
    pub fn internal_ident(&self) -> Ident {
×
131
        format_ident!("_internal_{}", &self.ident)
×
132
    }
133

NEW
134
    pub fn abstract_function_builder(&self) -> TokenStream {
×
NEW
135
        let name = &self.name;
×
NEW
136
        let (required, not_required) = self.args.split_args(self.optional.as_ref());
×
137

138
        // `entry` impl
NEW
139
        let required_args = required
×
140
            .iter()
NEW
141
            .map(TypedArg::arg_builder)
×
142
            .collect::<Vec<_>>();
NEW
143
        let not_required_args = not_required
×
144
            .iter()
NEW
145
            .map(TypedArg::arg_builder)
×
146
            .collect::<Vec<_>>();
147

NEW
148
        let returns = self.build_returns();
×
NEW
149
        let docs = if self.docs.is_empty() {
×
NEW
150
            quote! {}
×
151
        } else {
NEW
152
            let docs = &self.docs;
×
NEW
153
            quote! {
×
NEW
154
                .docs(&[#(#docs),*])
×
155
            }
156
        };
157

NEW
158
        quote! {
×
NEW
159
            ::ext_php_rs::builders::FunctionBuilder::new_abstract(#name)
×
NEW
160
            #(.arg(#required_args))*
×
NEW
161
            .not_required()
×
NEW
162
            #(.arg(#not_required_args))*
×
NEW
163
            #returns
×
NEW
164
            #docs
×
165
        }
166
    }
167

168
    /// Generates the function builder for the function.
169
    pub fn function_builder(&self, call_type: CallType) -> TokenStream {
×
170
        let name = &self.name;
×
171
        let (required, not_required) = self.args.split_args(self.optional.as_ref());
×
172

173
        // `handler` impl
174
        let arg_declarations = self
×
175
            .args
×
176
            .typed
×
177
            .iter()
178
            .map(TypedArg::arg_declaration)
×
179
            .collect::<Vec<_>>();
180

181
        // `entry` impl
182
        let required_args = required
×
183
            .iter()
184
            .map(TypedArg::arg_builder)
×
185
            .collect::<Vec<_>>();
186
        let not_required_args = not_required
×
187
            .iter()
188
            .map(TypedArg::arg_builder)
×
189
            .collect::<Vec<_>>();
190

191
        let returns = self.build_returns();
×
192
        let result = self.build_result(call_type, required, not_required);
×
193
        let docs = if self.docs.is_empty() {
×
194
            quote! {}
×
195
        } else {
196
            let docs = &self.docs;
×
197
            quote! {
×
198
                .docs(&[#(#docs),*])
×
199
            }
200
        };
201

202
        quote! {
×
203
            ::ext_php_rs::builders::FunctionBuilder::new(#name, {
×
204
                ::ext_php_rs::zend_fastcall! {
×
205
                    extern fn handler(
×
206
                        ex: &mut ::ext_php_rs::zend::ExecuteData,
×
207
                        retval: &mut ::ext_php_rs::types::Zval,
×
208
                    ) {
209
                        use ::ext_php_rs::convert::IntoZval;
×
210

211
                        #(#arg_declarations)*
×
212
                        let result = {
×
213
                            #result
×
214
                        };
215

216
                        if let Err(e) = result.set_zval(retval, false) {
×
217
                            let e: ::ext_php_rs::exception::PhpException = e.into();
×
218
                            e.throw().expect("Failed to throw PHP exception.");
×
219
                        }
220
                    }
221
                }
222
                handler
×
223
            })
224
            #(.arg(#required_args))*
×
225
            .not_required()
×
226
            #(.arg(#not_required_args))*
×
227
            #returns
×
228
            #docs
×
229
        }
230
    }
231

232
    fn build_returns(&self) -> Option<TokenStream> {
×
233
        self.output.cloned().map(|mut output| {
×
234
            output.drop_lifetimes();
×
235
            quote! {
×
236
                .returns(
×
237
                    <#output as ::ext_php_rs::convert::IntoZval>::TYPE,
×
238
                    false,
×
239
                    <#output as ::ext_php_rs::convert::IntoZval>::NULLABLE,
×
240
                )
241
            }
242
        })
243
    }
244

245
    fn build_result(
×
246
        &self,
247
        call_type: CallType,
248
        required: &[TypedArg<'_>],
249
        not_required: &[TypedArg<'_>],
250
    ) -> TokenStream {
251
        let ident = self.ident;
×
252
        let required_arg_names: Vec<_> = required.iter().map(|arg| arg.name).collect();
×
253
        let not_required_arg_names: Vec<_> = not_required.iter().map(|arg| arg.name).collect();
×
254

255
        let arg_accessors = self.args.typed.iter().map(|arg| {
×
256
            arg.accessor(|e| {
×
257
                quote! {
×
258
                    #e.throw().expect("Failed to throw PHP exception.");
×
259
                    return;
×
260
                }
261
            })
262
        });
263

264
        match call_type {
×
265
            CallType::Function => quote! {
×
266
                let parse = ex.parser()
×
267
                    #(.arg(&mut #required_arg_names))*
×
268
                    .not_required()
×
269
                    #(.arg(&mut #not_required_arg_names))*
×
270
                    .parse();
×
271
                if parse.is_err() {
×
272
                    return;
×
273
                }
274

275
                #ident(#({#arg_accessors}),*)
×
276
            },
277
            CallType::Method { class, receiver } => {
×
278
                let this = match receiver {
×
279
                    MethodReceiver::Static => quote! {
×
280
                        let parse = ex.parser();
×
281
                    },
282
                    MethodReceiver::ZendClassObject | MethodReceiver::Class => quote! {
×
283
                        let (parse, this) = ex.parser_method::<#class>();
×
284
                        let this = match this {
×
285
                            Some(this) => this,
×
286
                            None => {
×
287
                                ::ext_php_rs::exception::PhpException::default("Failed to retrieve reference to `$this`".into())
×
288
                                    .throw()
×
289
                                    .unwrap();
×
290
                                return;
×
291
                            }
292
                        };
293
                    },
294
                };
295
                let call = match receiver {
×
296
                    MethodReceiver::Static => {
×
297
                        quote! { #class::#ident(#({#arg_accessors}),*) }
×
298
                    }
299
                    MethodReceiver::Class => quote! { this.#ident(#({#arg_accessors}),*) },
×
300
                    MethodReceiver::ZendClassObject => {
×
301
                        quote! { #class::#ident(this, #({#arg_accessors}),*) }
×
302
                    }
303
                };
304
                quote! {
×
305
                    #this
×
306
                    let parse_result = parse
×
307
                        #(.arg(&mut #required_arg_names))*
×
308
                        .not_required()
×
309
                        #(.arg(&mut #not_required_arg_names))*
×
310
                        .parse();
×
311
                    if parse_result.is_err() {
×
312
                        return;
×
313
                    }
314

315
                    #call
×
316
                }
317
            }
318
        }
319
    }
320

321
    /// Generates a struct and impl for the `PhpFunction` trait.
322
    pub fn php_function_impl(&self) -> TokenStream {
×
323
        let internal_ident = self.internal_ident();
×
324
        let builder = self.function_builder(CallType::Function);
×
325

326
        quote! {
×
327
            #[doc(hidden)]
×
328
            #[allow(non_camel_case_types)]
×
329
            struct #internal_ident;
×
330

331
            impl ::ext_php_rs::internal::function::PhpFunction for #internal_ident {
×
332
                const FUNCTION_ENTRY: fn() -> ::ext_php_rs::builders::FunctionBuilder<'static> = {
×
333
                    fn entry() -> ::ext_php_rs::builders::FunctionBuilder<'static>
×
334
                    {
335
                        #builder
×
336
                    }
337
                    entry
×
338
                };
339
            }
340
        }
341
    }
342

343
    /// Returns a constructor metadata object for this function. This doesn't
344
    /// check if the function is a constructor, however.
345
    pub fn constructor_meta(&self, class: &syn::Path) -> TokenStream {
×
346
        let ident = self.ident;
×
347
        let (required, not_required) = self.args.split_args(self.optional.as_ref());
×
348
        let required_args = required
×
349
            .iter()
350
            .map(TypedArg::arg_builder)
×
351
            .collect::<Vec<_>>();
352
        let not_required_args = not_required
×
353
            .iter()
354
            .map(TypedArg::arg_builder)
×
355
            .collect::<Vec<_>>();
356

357
        let required_arg_names: Vec<_> = required.iter().map(|arg| arg.name).collect();
×
358
        let not_required_arg_names: Vec<_> = not_required.iter().map(|arg| arg.name).collect();
×
359
        let arg_declarations = self
×
360
            .args
×
361
            .typed
×
362
            .iter()
363
            .map(TypedArg::arg_declaration)
×
364
            .collect::<Vec<_>>();
365
        let arg_accessors = self.args.typed.iter().map(|arg| {
×
366
            arg.accessor(
×
367
                |e| quote! { return ::ext_php_rs::class::ConstructorResult::Exception(#e); },
×
368
            )
369
        });
370
        let variadic = self.args.typed.iter().any(|arg| arg.variadic).then(|| {
×
371
            quote! {
×
372
                .variadic()
×
373
            }
374
        });
375
        let docs = &self.docs;
×
376

377
        quote! {
×
378
            ::ext_php_rs::class::ConstructorMeta {
×
379
                constructor: {
×
380
                    fn inner(ex: &mut ::ext_php_rs::zend::ExecuteData) -> ::ext_php_rs::class::ConstructorResult<#class> {
×
381
                        #(#arg_declarations)*
×
382
                        let parse = ex.parser()
×
383
                            #(.arg(&mut #required_arg_names))*
×
384
                            .not_required()
×
385
                            #(.arg(&mut #not_required_arg_names))*
×
386
                            #variadic
×
387
                            .parse();
×
388
                        if parse.is_err() {
×
389
                            return ::ext_php_rs::class::ConstructorResult::ArgError;
×
390
                        }
391
                        #class::#ident(#({#arg_accessors}),*).into()
×
392
                    }
393
                    inner
×
394
                },
395
                build_fn: {
×
396
                    fn inner(func: ::ext_php_rs::builders::FunctionBuilder) -> ::ext_php_rs::builders::FunctionBuilder {
×
397
                        func
×
398
                            .docs(&[#(#docs),*])
×
399
                            #(.arg(#required_args))*
×
400
                            .not_required()
×
401
                            #(.arg(#not_required_args))*
×
402
                            #variadic
×
403
                    }
404
                    inner
×
405
                }
406
            }
407
        }
408
    }
409
}
410

411
#[derive(Debug)]
412
pub struct ReceiverArg {
413
    pub _mutable: bool,
414
    pub span: Span,
415
}
416

417
#[derive(Debug)]
418
pub struct TypedArg<'a> {
419
    pub name: &'a Ident,
420
    pub ty: Type,
421
    pub nullable: bool,
422
    pub default: Option<Expr>,
423
    pub as_ref: bool,
424
    pub variadic: bool,
425
}
426

427
#[derive(Debug)]
428
pub struct Args<'a> {
429
    pub receiver: Option<ReceiverArg>,
430
    pub typed: Vec<TypedArg<'a>>,
431
}
432

433
impl<'a> Args<'a> {
434
    pub fn parse_from_fnargs(
×
435
        args: impl Iterator<Item = &'a FnArg>,
436
        mut defaults: HashMap<Ident, Expr>,
437
    ) -> Result<Self> {
438
        let mut result = Self {
439
            receiver: None,
440
            typed: vec![],
×
441
        };
442
        for arg in args {
×
443
            match arg {
×
444
                FnArg::Receiver(receiver) => {
×
445
                    if receiver.reference.is_none() {
×
446
                        bail!(receiver => "PHP objects are heap-allocated and cannot be passed by value. Try using `&self` or `&mut self`.");
×
447
                    } else if result.receiver.is_some() {
×
448
                        bail!(receiver => "Too many receivers specified.")
×
449
                    }
450
                    result.receiver.replace(ReceiverArg {
×
451
                        _mutable: receiver.mutability.is_some(),
×
452
                        span: receiver.span(),
×
453
                    });
454
                }
455
                FnArg::Typed(PatType { pat, ty, .. }) => {
×
456
                    let syn::Pat::Ident(syn::PatIdent { ident, .. }) = &**pat else {
×
457
                        bail!(pat => "Unsupported argument.");
×
458
                    };
459

460
                    // If the variable is `&[&Zval]` treat it as the variadic argument.
461
                    let default = defaults.remove(ident);
×
462
                    let nullable = type_is_nullable(ty.as_ref(), default.is_some())?;
×
463
                    let (variadic, as_ref, ty) = Self::parse_typed(ty);
×
464
                    result.typed.push(TypedArg {
×
465
                        name: ident,
×
466
                        ty,
×
467
                        nullable,
×
468
                        default,
×
469
                        as_ref,
×
470
                        variadic,
×
471
                    });
472
                }
473
            }
474
        }
475
        Ok(result)
×
476
    }
477

478
    fn parse_typed(ty: &Type) -> (bool, bool, Type) {
×
479
        match ty {
×
480
            Type::Reference(ref_) => {
×
481
                let as_ref = ref_.mutability.is_some();
×
482
                match ref_.elem.as_ref() {
×
483
                    Type::Slice(slice) => (
×
484
                        // TODO: Allow specifying the variadic type.
485
                        slice.elem.to_token_stream().to_string() == "& Zval",
×
486
                        as_ref,
×
487
                        ty.clone(),
×
488
                    ),
489
                    _ => (false, as_ref, ty.clone()),
×
490
                }
491
            }
492
            Type::Path(TypePath { path, .. }) => {
×
493
                let mut as_ref = false;
×
494

495
                // For for types that are `Option<&mut T>` to turn them into
496
                // `Option<&T>`, marking the Arg as as "passed by reference".
497
                let ty = path
×
498
                    .segments
×
499
                    .last()
500
                    .filter(|seg| seg.ident == "Option")
×
501
                    .and_then(|seg| {
×
502
                        if let PathArguments::AngleBracketed(args) = &seg.arguments {
×
503
                            args.args
×
504
                                .iter()
×
505
                                .find(|arg| matches!(arg, GenericArgument::Type(_)))
×
506
                                .and_then(|ga| match ga {
×
507
                                    GenericArgument::Type(ty) => Some(match ty {
×
508
                                        Type::Reference(r) => {
×
509
                                            let mut new_ref = r.clone();
×
510
                                            new_ref.mutability = None;
×
511
                                            as_ref = true;
×
512
                                            Type::Reference(new_ref)
×
513
                                        }
514
                                        _ => ty.clone(),
×
515
                                    }),
516
                                    _ => None,
×
517
                                })
518
                        } else {
519
                            None
×
520
                        }
521
                    })
522
                    .unwrap_or_else(|| ty.clone());
×
523
                (false, as_ref, ty.clone())
×
524
            }
525
            _ => (false, false, ty.clone()),
×
526
        }
527
    }
528

529
    /// Splits the typed arguments into two slices:
530
    ///
531
    /// 1. Required arguments.
532
    /// 2. Non-required arguments.
533
    ///
534
    /// # Parameters
535
    ///
536
    /// * `optional` - The first optional argument. If [`None`], the optional
537
    ///   arguments will be from the first nullable argument after the last
538
    ///   non-nullable argument to the end of the arguments.
539
    pub fn split_args(&self, optional: Option<&Ident>) -> (&[TypedArg<'a>], &[TypedArg<'a>]) {
×
540
        let mut mid = None;
×
541
        for (i, arg) in self.typed.iter().enumerate() {
×
542
            if let Some(optional) = optional {
×
543
                if optional == arg.name {
×
544
                    mid.replace(i);
×
545
                }
546
            } else if mid.is_none() && arg.nullable {
×
547
                mid.replace(i);
×
548
            } else if !arg.nullable {
×
549
                mid.take();
×
550
            }
551
        }
552
        match mid {
×
553
            Some(mid) => (&self.typed[..mid], &self.typed[mid..]),
×
554
            None => (&self.typed[..], &self.typed[0..0]),
×
555
        }
556
    }
557
}
558

559
impl TypedArg<'_> {
560
    /// Returns a 'clean type' with the lifetimes removed. This allows the type
561
    /// to be used outside of the original function context.
562
    fn clean_ty(&self) -> Type {
×
563
        let mut ty = self.ty.clone();
×
564
        ty.drop_lifetimes();
×
565

566
        // Variadic arguments are passed as slices, so we need to extract the
567
        // inner type.
568
        if self.variadic {
×
569
            let Type::Reference(reference) = &ty else {
×
570
                return ty;
×
571
            };
572

573
            if let Type::Slice(inner) = &*reference.elem {
×
574
                return *inner.elem.clone();
575
            }
576
        }
577

578
        ty
×
579
    }
580

581
    /// Returns a token stream containing an argument declaration, where the
582
    /// name of the variable holding the arg is the name of the argument.
583
    fn arg_declaration(&self) -> TokenStream {
×
584
        let name = self.name;
×
585
        let val = self.arg_builder();
×
586
        quote! {
×
587
            let mut #name = #val;
588
        }
589
    }
590

591
    /// Returns a token stream containing the `Arg` definition to be passed to
592
    /// `ext-php-rs`.
593
    fn arg_builder(&self) -> TokenStream {
×
594
        let name = self.name.to_string();
×
595
        let ty = self.clean_ty();
×
596
        let null = if self.nullable {
×
597
            Some(quote! { .allow_null() })
×
598
        } else {
599
            None
×
600
        };
601
        let default = self.default.as_ref().map(|val| {
×
602
            let val = val.to_token_stream().to_string();
×
603
            quote! {
×
604
                .default(#val)
605
            }
606
        });
607
        let as_ref = if self.as_ref {
×
608
            Some(quote! { .as_ref() })
×
609
        } else {
610
            None
×
611
        };
612
        let variadic = self.variadic.then(|| quote! { .is_variadic() });
×
613
        quote! {
×
614
            ::ext_php_rs::args::Arg::new(#name, <#ty as ::ext_php_rs::convert::FromZvalMut>::TYPE)
615
                #null
616
                #default
617
                #as_ref
618
                #variadic
619
        }
620
    }
621

622
    /// Get the accessor used to access the value of the argument.
623
    fn accessor(&self, bail_fn: impl Fn(TokenStream) -> TokenStream) -> TokenStream {
×
624
        let name = self.name;
×
625
        if let Some(default) = &self.default {
×
626
            quote! {
×
627
                #name.val().unwrap_or(#default.into())
×
628
            }
629
        } else if self.variadic {
×
630
            quote! {
×
631
                &#name.variadic_vals()
×
632
            }
633
        } else if self.nullable {
×
634
            // Originally I thought we could just use the below case for `null` options, as
635
            // `val()` will return `Option<Option<T>>`, however, this isn't the case when
636
            // the argument isn't given, as the underlying zval is null.
637
            quote! {
×
638
                #name.val()
×
639
            }
640
        } else {
641
            let bail = bail_fn(quote! {
×
642
                ::ext_php_rs::exception::PhpException::default(
×
643
                    concat!("Invalid value given for argument `", stringify!(#name), "`.").into()
×
644
                )
645
            });
646
            quote! {
×
647
                match #name.val() {
×
648
                    Some(val) => val,
×
649
                    None => {
×
650
                        #bail;
×
651
                    }
652
                }
653
            }
654
        }
655
    }
656
}
657

658
/// Returns true of the given type is nullable in PHP.
659
// TODO(david): Eventually move to compile-time constants for this (similar to
660
// FromZval::NULLABLE).
661
pub fn type_is_nullable(ty: &Type, has_default: bool) -> Result<bool> {
×
662
    Ok(match ty {
×
663
        syn::Type::Path(path) => {
×
664
            has_default
665
                || path
×
666
                    .path
×
667
                    .segments
×
668
                    .iter()
×
669
                    .next_back()
670
                    .is_some_and(|seg| seg.ident == "Option")
×
671
        }
672
        syn::Type::Reference(_) => false, /* Reference cannot be nullable unless */
×
673
        // wrapped in `Option` (in that case it'd be a Path).
674
        _ => bail!(ty => "Unsupported argument type."),
×
675
    })
676
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc