bindgen 0.16.0

A binding generator for Rust
Documentation
          fwd_decl(ctx, cursor, |ctx_| {
              let decl = decl_name(ctx_, cursor);
              let ci = decl.compinfo();
              cursor.visit(|c, p| {
                  let mut ci_ = ci.borrow_mut();
                  visit_composite(c, p, ctx_, &mut ci_.members)
              });
              ctx_.globals.push(GComp(ci));
          });

          CXChildVisit_Continue
      }
      CXCursor_EnumDecl => {
          fwd_decl(ctx, cursor, |ctx_| {
              let decl = decl_name(ctx_, cursor);
              let ei = decl.enuminfo();
              cursor.visit(|c, _| {
                  let mut ei_ = ei.borrow_mut();
                  visit_enum(c, &mut ei_.items)
              });
              ctx_.globals.push(GEnum(ei));
          });
          return CXChildVisit_Continue;
      }
      CXCursor_FunctionDecl => {
          let linkage = cursor.linkage();
          if linkage != CXLinkage_External && linkage != CXLinkage_UniqueExternal {
              return CXChildVisit_Continue;
          }

          let func = decl_name(ctx, cursor);
          let vi = func.varinfo();
          let mut vi = vi.borrow_mut();

          vi.ty = TFuncPtr(mk_fn_sig(ctx, &cursor.cur_type(), cursor));
          ctx.globals.push(func);

          return CXChildVisit_Continue;
      }
      CXCursor_VarDecl => {
          let linkage = cursor.linkage();
          if linkage != CXLinkage_External && linkage != CXLinkage_UniqueExternal {
              return CXChildVisit_Continue;
          }

          let ty = conv_ty(ctx, &cursor.cur_type(), cursor);
          let var = decl_name(ctx, cursor);
          let vi = var.varinfo();
          let mut vi = vi.borrow_mut();
          vi.ty = ty.clone();
          vi.is_const = cursor.cur_type().is_const();
          ctx.globals.push(var);

          return CXChildVisit_Continue;
      }
      CXCursor_TypedefDecl => {
          let mut under_ty = cursor.typedef_type();
          if under_ty.kind() == CXType_Unexposed {
              under_ty = under_ty.canonical_type();
          }

          let ty = conv_ty(ctx, &under_ty, cursor);
          let typedef = decl_name(ctx, cursor);
          let ti = typedef.typeinfo();
          let mut ti = ti.borrow_mut();
          ti.ty = ty.clone();
          ctx.globals.push(typedef);

          opaque_ty(ctx, &under_ty);

          return CXChildVisit_Continue;
      }
      CXCursor_FieldDecl => {
          return CXChildVisit_Continue;
      }
      _ => return CXChildVisit_Continue,