Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
followers_j.ml1 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(* Auto-generated from "followers.atd" *) [@@@ocaml.warning "-27-32-33-35-39"] type followers = Followers_t.followers = { href: string option; total: int } let write__string_nullable = ( Atdgen_runtime.Oj_run.write_nullable ( Yojson.Safe.write_string ) ) let string_of__string_nullable ?(len = 1024) x = let ob = Buffer.create len in write__string_nullable ob x; Buffer.contents ob let read__string_nullable = ( fun p lb -> Yojson.Safe.read_space p lb; (if Yojson.Safe.read_null_if_possible p lb then None else Some (( Atdgen_runtime.Oj_run.read_string ) p lb) : _ option) ) let _string_nullable_of_string s = read__string_nullable (Yojson.Safe.init_lexer ()) (Lexing.from_string s) let write_followers : _ -> followers -> _ = ( fun ob (x : followers) -> Buffer.add_char ob '{'; let is_first = ref true in if !is_first then is_first := false else Buffer.add_char ob ','; Buffer.add_string ob "\"href\":"; ( write__string_nullable ) ob x.href; if !is_first then is_first := false else Buffer.add_char ob ','; Buffer.add_string ob "\"total\":"; ( Yojson.Safe.write_int ) ob x.total; Buffer.add_char ob '}'; ) let string_of_followers ?(len = 1024) x = let ob = Buffer.create len in write_followers ob x; Buffer.contents ob let read_followers = ( fun p lb -> Yojson.Safe.read_space p lb; Yojson.Safe.read_lcurl p lb; let field_href = ref (None) in let field_total = ref (None) in try Yojson.Safe.read_space p lb; Yojson.Safe.read_object_end lb; Yojson.Safe.read_space p lb; let f = fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'f' then ( 0 ) else ( -1 ) ) | 5 -> ( if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' then ( 1 ) else ( -1 ) ) | _ -> ( -1 ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_href := ( Some ( ( read__string_nullable ) p lb ) ); | 1 -> field_total := ( Some ( ( Atdgen_runtime.Oj_run.read_int ) p lb ) ); | _ -> ( Yojson.Safe.skip_json p lb ) ); while true do Yojson.Safe.read_space p lb; Yojson.Safe.read_object_sep p lb; Yojson.Safe.read_space p lb; let f = fun s pos len -> if pos < 0 || len < 0 || pos + len > String.length s then invalid_arg (Printf.sprintf "out-of-bounds substring position or length: string = %S, requested position = %i, requested length = %i" s pos len); match len with | 4 -> ( if String.unsafe_get s pos = 'h' && String.unsafe_get s (pos+1) = 'r' && String.unsafe_get s (pos+2) = 'e' && String.unsafe_get s (pos+3) = 'f' then ( 0 ) else ( -1 ) ) | 5 -> ( if String.unsafe_get s pos = 't' && String.unsafe_get s (pos+1) = 'o' && String.unsafe_get s (pos+2) = 't' && String.unsafe_get s (pos+3) = 'a' && String.unsafe_get s (pos+4) = 'l' then ( 1 ) else ( -1 ) ) | _ -> ( -1 ) in let i = Yojson.Safe.map_ident p f lb in Atdgen_runtime.Oj_run.read_until_field_value p lb; ( match i with | 0 -> field_href := ( Some ( ( read__string_nullable ) p lb ) ); | 1 -> field_total := ( Some ( ( Atdgen_runtime.Oj_run.read_int ) p lb ) ); | _ -> ( Yojson.Safe.skip_json p lb ) ); done; assert false; with Yojson.End_of_object -> ( ( { href = (match !field_href with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "href"); total = (match !field_total with Some x -> x | None -> Atdgen_runtime.Oj_run.missing_field p "total"); } : followers) ) ) let followers_of_string s = read_followers (Yojson.Safe.init_lexer ()) (Lexing.from_string s)